Skip to content

Conversation

@rodrigo-fournier-immutable
Copy link
Contributor

Summary

This PR enhances error diagnostics in the Game Bridge for Unity and Unreal, and consolidates the parcel build output into a single inline HTML file.

Changes

Error Diagnostics Enhancement

  • Enriched error messages for USER_REGISTRATION_ERROR with:
    • HTTP status code
    • Full URL
    • Trace IDs (x-amzn-trace-id, x-trace-id)
    • Request IDs (x-amzn-requestid, x-request-id)
    • CloudFlare Ray ID (cf-ray)
    • Response body snippet (truncated to 200 chars)
  • Extensive debug logging with [GAME-BRIDGE] prefix for easier troubleshooting in CI logs
  • Browser feature detection logging (BigInt, fetch, ErrorCause, TextEncoder, Promise, AsyncFunction)
  • HTTP error context logging when network failures occur (especially for IMX offchain registration)

Build Consolidation

  • Created fixUnityBuild.js script to consolidate all parcel-generated JavaScript files into a single inline index.html
  • Updated build scripts (build and build:local) to call fixUnityBuild.js after parcel build
  • Removed separate .js and .map files after consolidation for cleaner Unity integration

Other

  • Updated target browser to Chrome 137 for Unity and Unreal builds
  • Updated pnpm-lock.yaml to resolve conflicts with latest main branch
  • Added packages/game-bridge/scripts/**/*.js to .eslintignore

Testing

  • ✅ All ESLint checks pass
  • ✅ Pre-commit hooks pass
  • 🔄 Will trigger automated Game Bridge build that creates PRs in Unity and Unreal SDKs

Impact

  • Unity SDK: Will receive enriched error messages in CI logs, making it easier to debug registration failures
  • Unreal SDK: Same benefits as Unity
  • Developers: Better visibility into HTTP failures during local development

…tput

- Add extensive debug logging with [GAME-BRIDGE] prefix for easier troubleshooting
- Enrich USER_REGISTRATION_ERROR messages with HTTP status, URL, trace IDs, request IDs, cf-ray, and response snippets
- Create fixUnityBuild.js script to consolidate all parcel-generated JS files into a single inline index.html
- Update build scripts to call fixUnityBuild.js after parcel build
- Ensure enriched error messages (with httpStatus/url/trace/reqId/resp) are returned to Unity for CI visibility
- Add browser feature detection logging (BigInt, fetch, ErrorCause, etc.)
- Log detailed HTTP error context when network failures occur (especially for IMX offchain registration)
- Update target browser to Chrome 137 for Unity and Unreal builds
@nx-cloud
Copy link

nx-cloud bot commented Feb 3, 2026

View your CI Pipeline Execution ↗ for commit b062f89

Command Status Duration Result
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-04 00:49:23 UTC

Addressing PR review comments:

1. Remove debug logging added for E2E troubleshooting:
   - Removed verbose import/feature detection logs
   - Removed HTTP error detail console logs
   - Removed callbackToGame debug logs
   - Removed init flow logging
   - Keep only critical error logs visible to customers

2. Use real SDK version instead of hardcoded value:
   - Changed imxSdkVersionHeader from '0.42' to sdkVersionTag
   - Ensures backend receives actual SDK version via x-sdk-version header
   - Version is replaced by CI during build via updateSdkVersion script

3. Standardize error logging:
   - All remaining console.error calls use [GAME-BRIDGE] prefix consistently

4. Clean up unused code:
   - Removed logHttpErrorDetails function (no longer needed)
   - Error enrichment still works via getHttpErrorSummary
Remove potentially sensitive information from error diagnostics:

1. Remove responseSnippet from error messages:
   - Response body may contain tokens, API keys, or personal data
   - Security risk to expose this to game developers/users

2. Sanitize URLs to remove query parameters:
   - Query params may contain tokens, API keys, session IDs
   - Strip everything after '?' to protect sensitive data

3. Keep safe diagnostic information:
   - HTTP status codes
   - Sanitized URLs (path only)
   - Trace IDs (x-amzn-trace-id, x-trace-id)
   - Request IDs
   - CloudFlare Ray IDs

This ensures error messages are helpful for debugging without
exposing sensitive data to end users.
@rodrigo-fournier-immutable rodrigo-fournier-immutable added this pull request to the merge queue Feb 4, 2026
Merged via the queue into main with commit 9b16625 Feb 4, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants