Skip to content

respond to unknown requests with error#289

Open
kiftio wants to merge 1 commit into
mainfrom
06-16-respond_to_unknown_requests_with_error
Open

respond to unknown requests with error#289
kiftio wants to merge 1 commit into
mainfrom
06-16-respond_to_unknown_requests_with_error

Conversation

@kiftio

@kiftio kiftio commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

When the checkout bridge receives a JSON-RPC request for an unsupported or unknown method, it now returns a proper JSON-RPC error response with code -32601 ("Method not found") instead of silently ignoring it. This applies across all three platforms (Android, Swift, and Web).

The distinction between requests (messages with an id field) and notifications (messages without an id field) is now respected per the JSON-RPC spec: only requests receive an error response, while notifications continue to be silently ignored.

How to test

  1. Send a JSON-RPC message with an unsupported method and an id field (e.g. {"jsonrpc":"2.0","method":"ec.auth","id":"1","params":{}}) through the checkout bridge on any platform.
  2. Verify that a JSON-RPC error response is sent back containing "code": -32601 and "message": "Method not found", with the matching id.
  3. Send the same unsupported method without an id field (e.g. {"jsonrpc":"2.0","method":"ec.auth","params":{}}).
  4. Verify that no response is sent back.
  5. Verify that in both cases the message is not delegated to the client.

Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped the versionName in platforms/android/lib/build.gradle
  • I have updated platforms/android/CHANGELOG.md
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

kiftio commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

This was referenced Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Web — Coverage Report

Lines Statements Branches Functions
Coverage: 99%
98.52% (267/271) 88.55% (147/166) 100% (59/59)

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.66% (319/348) 87.86% (181/206) 100% (82/82)

@kiftio kiftio force-pushed the 06-16-hide_communication_client branch from 5f3a339 to 57049b1 Compare June 16, 2026 11:51
@kiftio kiftio force-pushed the 06-16-respond_to_unknown_requests_with_error branch 2 times, most recently from 129ae8e to b19959a Compare June 16, 2026 12:24
@kiftio kiftio force-pushed the 06-16-hide_communication_client branch from 57049b1 to 2d9284e Compare June 16, 2026 12:24
@kiftio kiftio mentioned this pull request Jun 16, 2026
11 tasks
@kiftio kiftio force-pushed the 06-16-respond_to_unknown_requests_with_error branch from b19959a to d9a76f4 Compare June 16, 2026 12:48
@kiftio kiftio force-pushed the 06-16-hide_communication_client branch from 2d9284e to 98a13f0 Compare June 16, 2026 12:48
@kiftio kiftio changed the base branch from 06-16-hide_communication_client to graphite-base/289 June 16, 2026 19:43
@kiftio kiftio force-pushed the 06-16-respond_to_unknown_requests_with_error branch from d9a76f4 to 7adc030 Compare June 16, 2026 19:44
@kiftio kiftio force-pushed the graphite-base/289 branch from 98a13f0 to 4b0d021 Compare June 16, 2026 19:44
@kiftio kiftio changed the base branch from graphite-base/289 to dk/ignore-unknown-messages June 16, 2026 19:44
@kiftio kiftio marked this pull request as ready for review June 16, 2026 20:05
@kiftio kiftio requested a review from a team as a code owner June 16, 2026 20:05
@tiagocandido

Copy link
Copy Markdown
Contributor

Soft non-blocking notes, mostly for consistency with the protocol spec:

  • iOS may want to include ec.buyer.change as a supported notification too. It is a known protocol notification, so this keeps iOS from treating it like an unknown method.
  • The new request-id check is useful for unknown methods. It may also be worth applying the same idea to supported request/response methods, so messages without an id stay fire-and-forget and do not get a response.
  • For method-not-found responses, it may be safer to only echo string/number/null ids and use null for anything else. That avoids sending a JSON-RPC error response with an invalid id.

Keeping these soft because I do not think they need to block this PR.

@tiagocandido tiagocandido 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.

Approved. Left a few soft non-blocking notes for protocol consistency.

@kiftio kiftio force-pushed the dk/ignore-unknown-messages branch from 4b0d021 to e711cb0 Compare June 18, 2026 09:06
@kiftio kiftio force-pushed the 06-16-respond_to_unknown_requests_with_error branch from 7adc030 to 0b3a610 Compare June 18, 2026 09:06
@kiftio kiftio changed the base branch from dk/ignore-unknown-messages to graphite-base/289 June 18, 2026 10:05
@kiftio kiftio force-pushed the 06-16-respond_to_unknown_requests_with_error branch from 0b3a610 to a425af4 Compare June 18, 2026 10:05
@kiftio kiftio force-pushed the graphite-base/289 branch from e711cb0 to 86e9f2e Compare June 18, 2026 10:05
@graphite-app graphite-app Bot changed the base branch from graphite-base/289 to main June 18, 2026 10:06
@kiftio kiftio force-pushed the 06-16-respond_to_unknown_requests_with_error branch 2 times, most recently from be24079 to 61965cf Compare June 18, 2026 11:12
@kiftio kiftio force-pushed the 06-16-respond_to_unknown_requests_with_error branch from 61965cf to ff31aa5 Compare June 18, 2026 13:59
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