Replies: 1 comment
-
I make my authorizer handler in a dedicated websocket stack like so:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a serverless application with APIGateway, lambda, and Dynamodb. It involves both a REST API and a Websocket API with NodeJS lambda handlers. In my Websocket API I use an authorizer for the onConnect route. What I have noticed is that sometimes after I cdk deploy I get the following error in CloudWatch: "Error: Cannot find module 'index'\nRequire stack:\n- /var/runtime/index.mjs"
Sure enough, when I go to my authorizer lambda handler in the console (under the code tab), I see node_modules, package.json, and package-lock.json but no index.js. This issue only occurs with this one lambda function, which is very odd. I have two dozen other lambda functions and none of them have this particular problem.
I found that I can simply cdk deploy again to fix this issue. When I do so, I can see the index.js file in the lambda's code tab as expected. I am developing on Windows and I often get those annoying "Resource is busy or locked" errors, and I have a hunch my problem is related. The "Resource is busy or locked" error causes deploy to crash and I have to deploy again. Maybe that interrupts the process of making the index.js file, I don't know.
How should I go about debugging this? I don't want my application to have a random chance of blowing up when I cdk deploy.
Beta Was this translation helpful? Give feedback.
All reactions