Skip to content

fix(apiGateway): support object form for apiKeys entries#716

Merged
zirkelc merged 1 commit intoserverless-operations:masterfrom
BANCS-Norway:fix-431-apikeys-usage-plan
Mar 26, 2026
Merged

fix(apiGateway): support object form for apiKeys entries#716
zirkelc merged 1 commit intoserverless-operations:masterfrom
BANCS-Norway:fix-431-apikeys-usage-plan

Conversation

@VirtueMe
Copy link
Copy Markdown
Collaborator

Summary

Fixes #431

usagePlanKeys.js was still rejecting any non-string apiKey entry with "API Keys must be strings", causing deployment failures when using the object form ({ name, value }). apiKeys.js had already been updated to accept objects (in #699), but usagePlanKeys.js was missed.

This PR:

  • Fixes usagePlanKeys.js to accept both strings and objects, consistent with apiKeys.js
  • Relaxes both files to not require a name property — value-only objects ({ value: '...' }) are valid since AWS auto-generates the key name
  • Adds tests for object-with-name-and-value, object-with-value-only in both files

Test plan

  • apiKeys: ['myKeyName'] — plain string array still works
  • apiKeys: [{ name: 'myKey', value: 'myValue' }] — name + value object works
  • apiKeys: [{ value: 'myValue' }] — value-only object works (AWS auto-generates name)
  • apiKeys: [{ name: 'myKey' }] — name-only object works
  • apiKeys: [2] — non-string, non-object still throws

🤖 Generated with Claude Code

Both apiKeys.js and usagePlanKeys.js now accept objects without
requiring a name property, allowing value-only keys where AWS
auto-generates the name.

Fixes serverless-operations#431

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/serverless-operations/serverless-step-functions@716

commit: e57d39c

@zirkelc zirkelc merged commit 3c7f8e4 into serverless-operations:master Mar 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API keys with values break deployment

2 participants