You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using ts-node I'm trying to use Typescript directly inside lambda function on AWS, to do this I'm using this sample code:
require('ts-node/register');console.log('Register!');const{ main }=require('./src/test.ts');exports.handler=asyncfunctionhandler(){console.log('Starting...');awaitmain();console.log('Done!');};
The problem is that in my lambda the node_modules directory is placed in a layer /opt/nodejs/node_modules
So what happens is that ts-node doesn't find libraries on the imported sources giving errors such:
src/test.ts(2,21): error TS2307: Cannot find module '@aws-sdk/client-s3' or its corresponding type declarations.
I'm trying to override the configuration of ts-node using this code, but still no luck.
This discussion was converted from issue #1430 on August 17, 2021 11:20.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Using
ts-node
I'm trying to use Typescript directly inside lambda function on AWS, to do this I'm using this sample code:The problem is that in my lambda the node_modules directory is placed in a layer
/opt/nodejs/node_modules
So what happens is that ts-node doesn't find libraries on the imported sources giving errors such:
I'm trying to override the configuration of ts-node using this code, but still no luck.
Thanks you in advance,
Regards
Beta Was this translation helpful? Give feedback.
All reactions