Closed adamhl8 closed 1 year ago
Hey there- thanks for reporting.
It's definitely an interesting edge case; I'll admit I don't actually use invoke local
, and as far as I'm aware it's impossible for a deployed lambda to run without any credentials (even if they're just for a role which isn't doing anything).
As you note - mixing in some credentials (either using the cli arguments, or you could have a default profile configured or enviornment variables) is a workaround.
I'm not against a PR - although it's quite possible the error is being thrown from the aws-sdk itself - but I don't have the bandwidth to fix it myself.
I'm going to close this as a bit of house keeping.
Thanks again for reporting, though.
Hey, I have the same problem. I use this plugin to try to deploy my app using aws SSO. But I develop using serverless-offline.
Whith this plugin, it's not possible to use serverless-offline. I have an error on credentials or profile
I am running into the same issues as @throrin19
@thomasmichaelwallace what are your thoughts on a PR that no-ops this plugin if the IS_OFFLINE
env variable is set? That's what serverless-offline
uses to signal it's running
I don't have a problem with it, if it works.
The interaction between plugins and credentials is weirdly complicated; especially now some plugins are based on v3 of the AWS-SDK.
Something else to try is the workaround I've added to the troubleshooting stage, where you provide a credentials file:
@thomasmichaelwallace PR for you here! https://github.com/thomasmichaelwallace/serverless-better-credentials/pull/33
I plan to use this to enable everywhere except local, where I don't need AWS creds:
params:
default:
better-credentials-enabled: true
local:
better-credentials-enabled: false
plugins:
- serverless-better-credentials
custom:
betterCredentials:
enabled: ${param:better-credentials-enabled}
If I invoke locally without any AWS credentials, e.g.
sls invoke local --function foo
, an error is thrown:Error: ENOENT: no such file or directory, open '~/.aws/credentials'
A workaround for this is to just create invalid AWS credentials:
serverless config credentials --provider aws --key NA --secret NA
The obvious answer is that I should just have actual credentials, but I don't think the plugin should throw an error if no credentials are found when invoking locally.