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

functions with more than 10 secrets (including generated vars) fail to resolve at runtime #2413

Open
josefaidt opened this issue Jan 7, 2025 · 3 comments
Labels
bug Something isn't working function Issue pertaining to Amplify Function good first issue Good for newcomers

Comments

@josefaidt
Copy link
Contributor

josefaidt commented Jan 7, 2025

Environment information

n/a

Describe the bug

when using defineFunction with more than 10 secrets, the SDK call fails to resolve due to a validation on the Names arg

Message: Value '[...]' at 'names' failed to satisfy constraint: 
Member must have length less than or equal to 10
ERROR   Uncaught Exception      {"errorType":"ValidationException","errorMessage":"1 validation error detected: Value '[...]' at 'names' failed to satisfy constraint: Member must have length less than or equal to 10","name":"ValidationException","$fault":"client","$metadata":{"httpStatusCode":400,"requestId":"05425c47-78fd-4b06-9757-3b01f61b984b","attempts":1,"totalRetryDelay":0},"__type":"ValidationException","message":"1 validation error detected: Value '[...]' at 'names' failed to satisfy constraint: Member must have length less than or equal to 10","stack":["ValidationException: 1 validation error detected: Value '[...]' at 'names' failed to satisfy constraint: Member must have length less than or equal to 10","    at throwDefaultError (/var/runtime/node_modules/@aws-sdk/node_modules/@smithy/smithy-client/dist-cjs/index.js:840:20)","    at /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/smithy-client/dist-cjs/index.js:849:5","    at de_CommandError (/var/runtime/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js:7021:14)","    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","    at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20","    at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/core/dist-cjs/index.js:165:18","    at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38","    at async /var/runtime/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:34:22","    at async resolveSecrets (file:///var/task/index.mjs:1:690)","    at async internalAmplifyFunctionResolveSsmParams (file:///var/task/index.mjs:1:1390)"]}

Reproduction steps

defineFunction({
  environment: {
    one: secret("one"),
    two: secret("two"),
    three: secret("three"),
    four: secret("four"),
    five: secret("five"),
    six: secret("six"),
    seven: secret("seven"),
    eight: secret("eight"),
    nine: secret("nine"),
    ten: secret("ten"),
    eleven: secret("eleven"),
  },
})
@josefaidt josefaidt added the pending-triage Incoming issues that need categorization label Jan 7, 2025
@ykethan
Copy link
Member

ykethan commented Jan 8, 2025

Was able to reproduce this issue, marking as bug.

@ykethan ykethan added pending-response Issue is pending response from author function Issue pertaining to Amplify Function bug Something isn't working and removed pending-triage Incoming issues that need categorization pending-response Issue is pending response from author labels Jan 8, 2025
@Orf1
Copy link

Orf1 commented Jan 10, 2025

Encountered this issue too, passing only 6 variables to my environment. I have 12 unique variables defined within Amplify Secret management.

@v-bilyavskiy
Copy link

v-bilyavskiy commented Jan 18, 2025

@Orf1 @josefaidt hello, if you are using pnpm, then until this problem is resolved you can use the patch(https://pnpm.io/cli/patch) for "@aws-amplify/backend-function"

"pnpm": {
    "patchedDependencies": {
      "@aws-amplify/backend-function": "patches/@aws-amplify__backend-function.patch"
    }
  }

@aws-amplify__backend-function.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working function Issue pertaining to Amplify Function good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants