Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pedrorioja opened this issue Apr 17, 2024 · 5 comments
Open

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

pedrorioja opened this issue Apr 17, 2024 · 5 comments

Comments

@pedrorioja
Copy link

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:

  • /function/node_modules/aws-lambda-ric/dist/index.mjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at NativeModuleLoader.js.exports.load (file:///function/node_modules/aws-lambda-ric/dist/index.mjs:439:26)
    at new RAPIDClient (file:///function/node_modules/aws-lambda-ric/dist/index.mjs:454:74)
    at run (file:///function/node_modules/aws-lambda-ric/dist/index.mjs:1411:18)
    at file:///function/node_modules/aws-lambda-ric/bin/index.mjs:14:7
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ '/function/node_modules/aws-lambda-ric/dist/index.mjs' ]
    }

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
Copy link

aydangoon commented May 4, 2024

running into the same issue... :/

the only workaround i could find was to install [email protected]

@ZipBrandon
Copy link

ZipBrandon commented Jun 7, 2024

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

@ZipBrandon
Copy link

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
Copy link

kferrone commented Sep 25, 2024

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
Copy link

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 [email protected] resolved the './rapid-client.node' pb but caused another one
throw new Error("Missing Runtime API Server configuration.");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants