fix(appsync): remove optional chaining from JS 1.0.0 resolvers#43
Open
dmeiser wants to merge 1 commit into
Open
fix(appsync): remove optional chaining from JS 1.0.0 resolvers#43dmeiser wants to merge 1 commit into
dmeiser wants to merge 1 commit into
Conversation
AppSync JS runtime 1.0.0 targets ES6/ES2015-style support and does not support ES2020 optional chaining (?.). Replaced with explicit null checks in three resolver files to prevent runtime parse/execution errors. - ensure_my_account_exists_fn.js - check_existing_share_fn.js - list_my_shares_resolver.js JS syntax verified with node --check; tofu validate passes (pre-existing hash_key deprecation warnings remain).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates AppSync JavaScript (runtime 1.0.0) resolvers to avoid ES2020 optional chaining (?.), replacing it with explicit null checks to prevent resolver parse/execution failures in the AppSync runtime.
Changes:
- Replaced
ctx.result?.itemswith an explicitctx.result && ctx.result.itemsguard inlistMySharesresponse handling. - Replaced optional-chained Cognito claim access with explicit
ctx.identity/claimschecks in account bootstrap logic. - Replaced optional-chained stash invite access with an explicit
ctx.stash.invitepresence check when selectingprofileId.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tofu/application/appsync/js-resolvers/list_my_shares_resolver.js | Removes optional chaining when reading ctx.result.items to keep the resolver compatible with AppSync JS 1.0.0. |
| tofu/application/appsync/js-resolvers/ensure_my_account_exists_fn.js | Removes optional chaining from identity claim lookup to prevent runtime syntax errors in AppSync JS 1.0.0. |
| tofu/application/appsync/js-resolvers/check_existing_share_fn.js | Removes optional chaining from ctx.stash.invite access to avoid unsupported syntax in AppSync JS 1.0.0. |
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.
AppSync JS runtime 1.0.0 does not support ES2020 optional chaining (
?.). Replaced?.with explicit null checks in three resolver files to prevent runtime parse/execution errors.ensure_my_account_exists_fn.jscheck_existing_share_fn.jslist_my_shares_resolver.jsValidation:
node --checkon all JS resolver files;tofu validateintofu/application/environments/devpasses (pre-existinghash_keydeprecation warnings remain).