when i type serverless deploy appear this error: ServerlessError: The security token included in the request is invalid.
我必须在我的serverless deploy
命令中指定 sls deploy --aws-profile
,如下所示:
sls deploy --aws-profile common
Can you provide more information?
Make sure that you've got the correct credentials in ~/.aws/config
and ~/.aws/credentials
. You can set these up by running aws configure
. More info here: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-quick-configuration
Also make sure that the IAM user in question has as an attached security policy that allows access to everything you need, such as CloudFormation.
In my case it was missing the localstack
entry in the serverless file. I had everything that should be inside it, but it was all inside custom
(instead of custom.localstack
).
In my case, I added region to the provider. I suppose it's not read from the credentials file.
provider:
name: aws
runtime: nodejs12.x
region: cn-northwest-1
to run the function from AWS you need to configure AWS with access_key_id and secret_access_key but to might get this error if you want to run the function locally so for that use this command
sls invoke local -f functionName
it will run the function locally not on aws
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.