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 occured. (arm64, docker) #77

Open
sdg9670 opened this issue Sep 6, 2023 · 8 comments
Open

Error occured. (arm64, docker) #77

sdg9670 opened this issue Sep 6, 2023 · 8 comments

Comments

@sdg9670
Copy link

sdg9670 commented Sep 6, 2023

Env: ubuntu, arm64, docker(node 18 image)

// test.js
exports.handler = async (event) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    }
    return response
}
npm install aws-lambda-ric
npx aws-lambda-ric test.handler

I got this error.

Executing 'test.handler' in function directory '/workspaces/test'
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string: construction from null is not valid
Aborted (core dumped)

how can I solve this problem?

@sdg9670 sdg9670 changed the title Error occured in docker. (construction from null is not valid) Error occured. (arm64, docker) Sep 6, 2023
@amitizle
Copy link

We're having the same issue, @sdg9670 did you manage to resolve it?

@amitizle
Copy link

We resolved it by using [email protected] and not the latest version.

@sdg9670
Copy link
Author

sdg9670 commented Sep 17, 2023

@amitizle I gave up to use arm64 cpu. lol...

@amunhoz
Copy link

amunhoz commented Sep 27, 2023

I'm having the same problem in amd64 with latest version, any clue?

@amitizle
Copy link

@amunhoz see my comment in here - try and use version 2.1.0

@schuettc
Copy link

We resolved it by using [email protected] and not the latest version.

This is working for me. But quite difficult to figure out. Would like an update on when ^3 will work with arm64

@carbontwelve
Copy link

I get the same error while following the official guide on using an alternative base image with the runtime interface client: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-image.html#nodejs-image-clients

This is on x86, node20.

@sin-ack
Copy link

sin-ack commented Nov 7, 2024

The cause of this is this bit of code:

static const std::string ENDPOINT(getenv("AWS_LAMBDA_RUNTIME_API"));

This uses getenv in a global initializer to get an environment variable during the load of the RIC. If the environment variable is not set, the STL will throw an exception, and Node.js has no way of recovering from that (since it happens at module load time). The correct fix is to check for the environment variable in Init and to just throw a JavaScript-level exception explaining that the environment variable must be set. You should be able to bypass this by setting the AWS_LAMBDA_RUNTIME_API environment variable for now.

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

6 participants