Closed marcingrabda closed 3 years ago
You can either pass in AWS_ env vars, or share your local config: https://github.com/lambci/docker-lambda/issues/313
This works when I want to connect to AWS, but what if I'm trying to run it in an integration test against local endpoints (using localstack)? Access/secret keys are not applicable in such a case.
How do you run such tests locally? If you can describe how this is a docker-lambda issue specifically, that might help narrow it down a little
Let's say I have a piece of code which initializes AWS-SDK and s3 service like this:
AWS.config.update({
region: 'us-east-1'
});
const s3 = new AWS.S3({
endpoint: 'http://localhost:4566'
});
Localstack runs on port 4566, thus the additional configuration. If I run this code without any docker containers, then it works just fine, but if I run it inside docker-lambda, then it fails with the error above.
What if you just pass in fake AWS_ credentials?
Btw, running locally isn't a good test of a sandboxed environment – the aws-sdk is probably reading your $HOME/.aws config.
Test in another docker image and see if you see the same behavior as you do in docker-lambda
Sorry for the late response. Passing fake AWS credentials actually helps. This isn't a limitation of docker-lambda, but aws-sdk.
I'm getting an error when running lambda which makes AWS SDK calls:
{"errorType":"CredentialsError","errorMessage":"Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1"}
Is this a well known issue? What's the recommended solution?