Closed socialyadept closed 2 years ago
Sorry I just now noticed this. My guess is you're target runtime (precisely which version of node are you targeting?) and the tsc compiler config (command line or tsconfig) aren't a match. If you're still struggling with this feel free to respond to this with more details about those things. A project that reproduces such issues is always the fastest way for the rest of us to help you troubleshoot. Sorry again for the terrible delay here I just missed it in my notifications. I'm closing this, but again feel free to respond or open another one with more detail.
Hi, I am trying to use this package in my Lambda Severless Repo to serve static html files likeso:
import StaticFileHandler from 'serverless-aws-static-file-handler'; import path = require('path');
const clientFilesPath = path.join(__dirname, './html/'); const fileHandler = new StaticFileHandler(clientFilesPath);
export const handler = async (event, _context) => { event.path = 'index.html'; // forcing a specific page for this handler, ignore requested path. This would serve ./data-files/index.html return fileHandler.get(event, _context); };
But whenever I try to run the code , it shows me this error (during the run time): × serverless_aws_static_file_handler_1.default is not a constructor × TypeError: serverless_aws_static_file_handler_1.default is not a constructor
I tried looking at this module and found out that the constructor does exist but still not able to fix this. constructor(clientFilesPath, customErrorPagePath = null) { if (clientFilesPath == null || clientFilesPath.length === 0) { throw new Error("clientFilesPath must be specified") } this.clientFilesPath = clientFilesPath this.customErrorPagePath = customErrorPagePath }
Any clue how can I solve this?
I am using typescript btw.