Skip to content

Commit

Permalink
Add a gotcha for streaming responses
Browse files Browse the repository at this point in the history
  • Loading branch information
byrichardpowell committed Sep 22, 2023
1 parent 7db38e0 commit 8be69a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ Using pnpm:
pnpm run shopify app config push
```

### Using Defer & await for streaming responses

To test defer/await locally you'll need to use the Shopify CLI slightly differently:

1. First setup ngrok: https://ngrok.com/product/secure-tunnels
2. Create an ngrok tunnel on port 8080: `ngrok http 8080`.
3. Copy the forwarding address. This should be something like: `https://f355-2607-fea8-bb5c-8700-7972-d2b5-3f2b-94ab.ngrok-free.app`
4. In a separate terminal run `yarn shopify app dev --tunnel-url=TUNNEL_URL:8080` replacing `TUNNEL_URL` for the address you copied in step 3.

By default the CLI uses a cloudflare tunnel. Unfortunately it looks like cloudflare tunnels wait for the Response stream to finish, then sends one chunk.

This will not affect production, since tunnels are only for local development.

## Benefits

Shopify apps are built on a variety of Shopify tools to create a great merchant experience.
Expand Down

0 comments on commit 8be69a1

Please sign in to comment.