Repository navigation
Conversation
`add payment-connector` builds the credential name as `<manager>-<connector>-<suffix>`, and connector names may contain underscores, so `--name my_cdp` produced `PayMgr-my_cdp-cdp`. CreatePaymentCredentialProvider accepts that name, but the connector's PaymentCredentialProviderConfiguration.credentialProviderArn only allows `[a-zA-Z0-9-.]+` after `paymentcredentialprovider/`, so the connector can't reference the provider. `agentcore validate` didn't catch it. - Replace underscores with hyphens when generating the credential name (`PayMgr-my-cdp-cdp`). The .env.local variable names are unchanged, since computePaymentCredentialEnvVarNames already maps `-` to `_`. - Make `agentcore validate` fail for payment connectors whose credentialName doesn't fit the ARN pattern, naming the credential to rename it to, so existing projects get an actionable error. - List the new check in docs/payments.md. Refs aws#2533
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
agentcore add payment-connectorbuilds the connector's credential name as<manager>-<connector>-<suffix>. Connector names may contain underscores, so--name my_cdpproduced the credentialPayMgr-my_cdp-cdp.CreatePaymentCredentialProvideraccepts underscores in the name, butPaymentCredentialProviderConfiguration.credentialProviderArnonly allows[a-zA-Z0-9-.]+afterpaymentcredentialprovider/, so the connector can't reference the provider.agentcore validatedidn't catch it. This is themainvariant of #2533.add payment-connectornow replaces underscores with hyphens in the generated credential name (my_cdp→PayMgr-my-cdp-cdp). The connector keeps its own name. The.env.localvariable names don't change, becausecomputePaymentCredentialEnvVarNamesalready maps-to_, so both names useAGENTCORE_CREDENTIAL_PAYMGR_MY_CDP_CDP_*.agentcore validatenow fails when a payment connector'scredentialNamedoesn't fit the ARN pattern, and names the credential to rename it to. This covers projects that already have an underscored credential name.docs/payments.mdlists the new validate check.Related Issue
Part of #2533. That issue targets the
refactorbranch, so this PR fixes the same problem onmainwithout closing it.Documentation PR
N/A
Type of Change
Testing
New unit tests cover the generated credential name (and its unchanged env var names), the
validatefailure with the rename hint, and the name check. The first two fail against the current code.I also ran the built CLI locally, comparing
mainand this branch:mainadd payment-connector --name my_cdpPayMgr-my_cdp-cdp,validatepassesPayMgr-my-cdp-cdp,validatepassesmain(underscored credential)validatepassesvalidatefails and namesPayMgr-my-cdp-cdp.env.localuntouchedvalidatepassesremove payment-connector.env.localvariablesI didn't deploy a real CoinbaseCDP connector; the ARN constraint comes from the API reference linked above.
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshots (no asset changes)Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.