"ServerlessError: The security token included in the request is invalid" on deploy
Closed this issue · 2 comments
node: v8.10
serverless: 1.27.3
OS: Mac
Running:
$ sls deploy
with a combination or all of the following flags:
$ --stage local
$ --aws-profile local
Ex: sls deploy --aws-profile local
results in:
ServerlessError: The security token included in the request is invalid
with no further logs shown from setting --verbose
.
Running Event Gateway locally w/
$ docker run -p 4000:4000 -p 4001:4001 -e "HOME=/home" -v ~/.aws:/home/.aws serverless/event-gateway -dev
Output:
2018-09-27T19:09:34.608Z INFO Running in development mode with embedded etcd. Events API listening on http://localhost:4000. Config API listening on http://localhost:4001.
taken straight from the official docs
serverless.yml:
service: profiles-service
provider:
name: aws
runtime: nodejs8.10
role: ***
stage: local
functions:
profiles:
handler: handler.profiles
events:
- eventgateway:
type: sync
eventType: http.request
path: /profiles/graphql
method: POST
plugins:
- serverless-webpack
- "@serverless/serverless-event-gateway-plugin"
custom:
webpack: .webpack.conf.js
eventgateway:
url: http://localhost:4000
accessKey: ***
What exactly is accessKey
referring to on a local setup? It doesn't appear to be the aws_access_key_id
nor the aws_secret_access_key
defined in ~/.aws/credentials
as I've copy-pasted those. Where would this local EG instance be setting or getting creds from if not from the passed in aws credentials?
How would I go about resolving this issue?
Also, as an aside, it doesn't appear as if the EG docker container is even port forwarding. When I curl http://localhost:4000
, I just get curl: (7) Failed to connect to localhost port 4000: Connection refused
. This is confirmed when running sls gateway dashboard
:
~~Event Gateway~~
~~ space: default~~
~~ endpoint: http://localhost:4000~~
~~ Fetch Error --------------------------------------------~~
~~ request to http://localhost:4001/v1/spaces/default/functions? failed, reason: connect ECONNREFUSED 127.0.0.1:4001~~
UPDATES:
- It does not appear to be to the
aws_session_token
either. - Blowing up Docker & reinstalling to latest seems to properly port forward
Think this is due to serverless
requiring locations to deploy CloudFormations & all. Feels strange at first, but makes sense.
Will try efforts to integrate localstack
somehow, though the sls package is poorly supported.
Closing for now.
Make sure to select proper profile $ export AWS_PROFILE=profile name
then run serverless deploy
- $ export AWS_PROFILE=profile name
- serverless deploy