2 Answers
- Newest
- Most votes
- Most comments
0
Hi Utsab,
this might be related to a change in behavior with the AWS SDK v3. A similar issue is documented in this GitHub issue: https://github.com/aws/aws-sdk-js-v3/issues/4867
Could you maybe share the relevant code parts of your Lambda function to help narrow this down?
Thanks, Ben
0
I lost days on this because I didn't realise the SAM build and deploy was including a local .env
file which had the AWS_PROFILE
variable set... My solution is to add a .npmignor
file specifying .env*
. This prevents the SAM packager from including the .env
file int he build that gets deployed.
answered 5 months ago
Relevant content
- asked 3 years ago
- Accepted Answerasked a year ago
- asked 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
Hi Ben, thank you for your prompt response.
As I mentioned earlier, the Lambda function is quite straightforward. It simply retrieves a JSON file from an S3 bucket and returns the corresponding JSON response.
Thanks for sharing the code. Is there a particular reason why you need the credentials explicitly? You can just create the S3 Client without additional configuration. See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html for
Please be also aware that as per documentation https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html, you normally don't need to use
fromNodeProviderChain
explicitly:Appreciate the detailed explanation! I initially faced issues with the default configuration of the S3 client, resulting in
Could not load credentials from any providers
error. To address this, I addedfromNodeProviderChain
as a precautionary measure. Interestingly, it didn't resolve the issue either.Hi, thanks for the quick response. Have you tried using the
@aws-sdk/credential-provider-node
instead. See also the comment on this question: https://repost.aws/questions/QUXMX9z9zCSb21qsnedFZQpg/having-trouble-converting-aws-node-sdk-v2-lambda-to-v3Tried using the
@aws-sdk/credential-provider-node
as well. Still getting the same error