Skip to content

fix(appsync): remove optional chaining from JS 1.0.0 resolvers#43

Open
dmeiser wants to merge 1 commit into
mainfrom
fix/appsync-js-optional-chaining
Open

fix(appsync): remove optional chaining from JS 1.0.0 resolvers#43
dmeiser wants to merge 1 commit into
mainfrom
fix/appsync-js-optional-chaining

Conversation

@dmeiser

@dmeiser dmeiser commented Jun 19, 2026

Copy link
Copy Markdown
Owner

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.js
  • check_existing_share_fn.js
  • list_my_shares_resolver.js

Validation: node --check on all JS resolver files; tofu validate in tofu/application/environments/dev passes (pre-existing hash_key deprecation warnings remain).

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).
Copilot AI review requested due to automatic review settings June 19, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?.items with an explicit ctx.result && ctx.result.items guard in listMyShares response handling.
  • Replaced optional-chained Cognito claim access with explicit ctx.identity / claims checks in account bootstrap logic.
  • Replaced optional-chained stash invite access with an explicit ctx.stash.invite presence check when selecting profileId.

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.

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.

2 participants