- Newest
- Most votes
- Most comments
I found the solution for anyone wondering...
The error was the order for my serverless.yml plugins, which should be the following:
plugins:
- serverless-plugin-typescript # Must be before transpilation plugins
- serverless-plugin-optimize # Can be before or after transpilation
- serverless-offline-sns # Can be in any order
- serverless-offline-sqs # Can be in any order
- serverless-offline # Must be last
- serverless-plugin-typescript: This plugin transpiles your TypeScript code to JavaScript. It needs to be placed before any plugins that modify the JavaScript code, thats why I was getting Error [ERR_MODULE_NOT_FOUND] as I had issue with my ts files, as serverless-offline plugin cannot find equivalent js file it throws error module not found as stated here serverless-plugin-typescript.
- serverless-offline: This plugin requires all the other plugins to be loaded first, so it should be placed last.
Following this order ensures that the plugins are executed in the correct sequence to achieve the desired outcome: transpiling TypeScript, potentially optimizing the code, and then setting up the offline environment.
Is there anyone that knows? I can't seem to find the problem. But the part that gives me that error is this section of my serverless.yml:
functions:
......
processExpenseAnalysisJob:
handler: src/functions/processExpenseAnalysisJob.handler
events:
- sns:
arn: arn:aws:sns:${self:provider.region}:${aws:accountId}:TextractTriggerTopic
.....
When I add the sns event to my lambda function, if I remove the event it works, but I can't seem to find what's wrong following this: https://www.serverless.com/plugins/serverless-offline-sns#configure. Before I had !GetAtt TextractTriggerTopic.TopicArn
but changed it as serverless-offline-sns doesn't recognize !GetAtt when running serverless offline.
Relevant content
- asked 2 months ago
- asked 2 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago