Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apiKeys with declared specific name and value are not utilized #1318

Closed
bitsofinfo opened this issue Dec 24, 2021 · 4 comments · Fixed by #1572
Closed

apiKeys with declared specific name and value are not utilized #1318

bitsofinfo opened this issue Dec 24, 2021 · 4 comments · Fixed by #1572
Assignees

Comments

@bitsofinfo
Copy link

serverless: 2.69.1
serverless-offline: 8.3.1

I have this declared:

  # api keys (values must be at least 20chars long)
  apiGateway:
    apiKeys:
      - name: ${self:service.name}-${opt:stage, 'dev'}-apiKey
         value: ${ssm:/aws/reference/secretsmanager/myapp/dev/apiKey}

I have a http event based function that is flagged as private: true

I start serverless-offline:

No matter what I am forced to use some generated key

...
offline: Starting Offline: local us-west-2.
offline: Key with token: d41d8cd98f00b204e9800998ecf8427e
offline: Remember to use x-api-key on the request headers
...

This syntax is valid in the serverless docs https://www.serverless.com/framework/docs/providers/aws/events/apigateway#setting-api-keys-for-your-rest-api

@bitsofinfo
Copy link
Author

#963

@medikoo
Copy link
Collaborator

medikoo commented Dec 27, 2021

@bitsofinfo thanks for report. PR with a fix is welcome

@dnalborczyk dnalborczyk reopened this Sep 5, 2022
@bitsofinfo
Copy link
Author

not sure why this was closed, definately an issue

@dnalborczyk
Copy link
Collaborator

@bitsofinfo I want to tackle this issue next. it looks like the flag (option) for setting an apiKey is really not needed, as it can be done with the serverless config itself (as your example is outlining above). it is possible that the apikeys key/value pair in the provider.apiGateway section was not introduced yet in serverless when support was implemented in serverless-offline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants