cli icon indicating copy to clipboard operation
cli copied to clipboard

Access GraphiQL on remote URL

Open amcaplan opened this issue 1 year ago β€’ 3 comments

WHY are these changes introduced?

Fixes #4223

We aren't able to access GraphiQL on a remote environment because the localhost URL is hardcoded.

WHAT is this pull request doing?

Pulls the URL from the request context, so even if it's behind a tunnel or proxy, the URLs will be correctly formed from the perspective of the browser.

How to test your changes?

  1. Run an HTTPS tunnel to localhost:3457
  2. p shopify app dev --path /path/to/your/app --graphiql-key=abcdef
  3. Hit g to open up GraphiQL. It will give an error page. Add ?key=abcdef to your URL and then it should work.
  4. Replace localhost:3457 with your tunnel URL on https. Everything should still work properly, including firing a GraphQL query.
  5. Try uninstalling your app and going through the install flow from GraphiQL. Things should work as normal.

Measuring impact

How do we know this change was effective? Please choose one:

  • [x] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • [ ] Existing analytics will cater for this addition
  • [ ] PR includes analytics changes to measure impact

Checklist

  • [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • [x] I've considered possible documentation changes

amcaplan avatar Aug 15 '24 20:08 amcaplan

We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

github-actions[bot] avatar Aug 15 '24 20:08 github-actions[bot]

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
73.28% (+0.09% πŸ”Ό)
8209/11203
🟑 Branches
69.65% (-0.01% πŸ”»)
3990/5729
🟑 Functions
71.85% (+0.03% πŸ”Ό)
2149/2991
🟑 Lines
73.6% (+0.1% πŸ”Ό)
7764/10549
Show files with reduced coverage πŸ”»
St.:grey_question:
File Statements Branches Functions Lines
πŸ”΄
... / server.ts
1.28% (-0.02% πŸ”»)
0% 0%
1.35% (-0.02% πŸ”»)
🟒
... / ConcurrentOutput.tsx
98.39% (-1.61% πŸ”»)
90.91% (-4.55% πŸ”»)
100%
98.33% (-1.67% πŸ”»)

Test suite run success

1854 tests passing in 846 suites.

Report generated by πŸ§ͺjest coverage report action from ef1a724ff4c32b62d2e06a286a7c40dbaa392769

github-actions[bot] avatar Aug 15 '24 20:08 github-actions[bot]

I'm electing to leave out a changeset, as we have not fully documented this feature yet - we still hide the --graphiql-key param and aren't documenting it. We need to make some time eventually to publish some sort of guide to how to use GraphiQL in app dev in the cloud.

amcaplan avatar Aug 15 '24 20:08 amcaplan