Open woodl3y opened 7 months ago
I encountered the same problem, and it's just after we upgraded from 13.3.1 to 13.3.2. We also had to downgrade to the previous version, I'm using node 20.9.0.
Facing similar issue with node 18x
Same, in 13.3.2 version after webpack building message Key with token: 'some generated api key hash'
does not appear anymore
This looks to be the BUG, I was checking their code,
https://github.com/dherault/serverless-offline/blob/c85a19272c59ad9e7cf1aea74e3442c7607b533a/src/events/http/HttpServer.js#L469
I can see that there is a check for x-api-key
but the master keySet doesnt have the required value. In my case when printed the whole key set, the only value that I see is [stage]-[lambda-name] . Eg. local-test-lambda-api
And now if I set the "x-api-key" to "local-test-lambda-api". THIS WORKS !!
Eventually the issue is with below piece of serverless.yml config
apiGateway:
apiKeys:
- ${self:service}-${opt:stage}-internal
So If you declare any of apiKeys under api gateway, the automatically created x-api-key will not be shown at all. just remove this apiKeys section, start local and you can see that x-api-key is shown on startup.
I hope this may help someone as quickfix.
Other alternative is to use --noAuth
with sls command, this will bypass the auth check alltogether.
Bug Report
Current Behavior
With the latest version
v13.3.2
we're no longer being provided with an API key when running locally.We see only the line
Remember to use 'x-api-key' on the request headers.
in the terminal, but no value forx-api-key
is provided. Reverting back tov13.3.1
we do get the additional lineKey with token: 'some-generated-token'
Expected behavior/code
When running locally using
sls offline start -s some_stage
we should be provided with a value forx-api-key
. The following line should be printed to the terminal as before:Key with token: 'some-token'
Environment
serverless
: v3.38.0serverless-offline
: v13.3.2serverless-plugin-aws-alerts
: v1.7.5serverless-domain-manager
: v7.3.3serverless-sqs-plugin-alarms
: v1.0.2serverless-logless-plugin
: v0.0.2serverless-log-forwarding
: v3.1.0serverless-plugin-cloudwatch-dashboard
: v1.2.0node.js
: v18.18.0