aws / aws-lambda-nodejs-runtime-interface-client

Apache License 2.0
188 stars 55 forks source link

Error: Cannot find module './rapid-client.node' #105

Open pedrorioja opened 7 months ago

pedrorioja commented 7 months ago

Hello, I am getting this error trying to run a docker on a lambda using an alternative base image with the runtime interface client.

`7 Apr 2024 14:01:50,774 [INFO] (rapid) exec '/usr/local/bin/npx' (cwd=/function, handler=index.handler) 17 Apr 2024 14:01:57,708 [INFO] (rapid) INIT START(type: on-demand, phase: init) 17 Apr 2024 14:01:57,709 [INFO] (rapid) The extension's directory "/opt/extensions" does not exist, assuming no extensions to be loaded. START RequestId: 79953563-5601-4e3c-b77c-ab118b367ef4 Version: $LATEST 17 Apr 2024 14:01:57,711 [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false Executing 'index.handler' in function directory '/function' node:internal/modules/cjs/loader:1140 const err = new Error(message); ^

Error: Cannot find module './rapid-client.node' Require stack:

Node.js v18.20.2 17 Apr 2024 14:01:58,891 [WARNING] (rapid) First fatal error stored in appctx: Runtime.ExitError 17 Apr 2024 14:01:58,892 [WARNING] (rapid) Process runtime-1 exited: exit status 1 17 Apr 2024 14:01:58,892 [INFO] (rapid) INIT RTDONE(status: error) 17 Apr 2024 14:01:58,892 [INFO] (rapid) INIT REPORT(durationMs: 1185.888000) 17 Apr 2024 14:01:58,892 [ERROR] (rapid) Init failed InvokeID= error=Runtime exited with error: exit status 1 17 Apr 2024 14:01:58,893 [WARNING] (rapid) Shutdown initiated: spindown 17 Apr 2024 14:01:58,893 [INFO] (rapid) Waiting for runtime domain processes termination 17 Apr 2024 14:01:58,894 [INFO] (rapid) INIT START(type: on-demand, phase: invoke) 17 Apr 2024 14:01:58,894 [INFO] (rapid) The extension's directory "/opt/extensions" does not exist, assuming no extensions to be loaded. 17 Apr 2024 14:01:58,894 [INFO] (rapid) INIT REPORT(durationMs: 0.060000) 17 Apr 2024 14:01:58,894 [INFO] (rapid) INVOKE START(requestId: 0fd547e3-fe80-44eb-a9e2-67b5cb4b8000) 17 Apr 2024 14:01:58,894 [ERROR] (rapid) Invoke failed error=Runtime exited with error: exit status 1 InvokeID=0fd547e3-fe80-44eb-a9e2-67b5cb4b8000 17 Apr 2024 14:01:58,897 [ERROR] (rapid) Invoke DONE failed: Sandbox.Failure 17 Apr 2024 14:01:58,897 [WARNING] (rapid) Reset initiated: ReleaseFail 17 Apr 2024 14:01:58,897 [INFO] (rapid) Waiting for runtime domain processes termination`

The rapid-client library is installed but does not have an exportable node file.

image
aydangoon commented 6 months ago

running into the same issue... :/

the only workaround i could find was to install aws-lambda-ric@2.1.0

ZipBrandon commented 5 months ago

I ran into this today just running AWS's tutorial. Thanks for the workaround.

ZipBrandon commented 5 months ago

I delved in more and I got around this by explicitly calling update-deps, preinstall and postinstall to compile the rapid-client.node. Btw - rapid-client.node is not the same thing as the unrelated npm package of the same name.

RUN npm install aws-lambda-ric
RUN cd node_modules/aws-lambda-ric && npm run update-deps && npm run preinstall && npm run postinstall
kferrone commented 2 months ago

Any updates here? I just came across this with Node20. @ZipBrandon your workaround didn't work for me. I tried locally on a Mac. sad...

hugoblanc commented 2 weeks ago

RUN cd node_modules/aws-lambda-ric && npm run update-deps && npm run preinstall && npm run postinstall

this seems to fix my issue thanks 🚀

installing aws-lambda-ric@2.1.0 resolved the './rapid-client.node' pb but caused another one throw new Error("Missing Runtime API Server configuration.");