diff --git a/README.md b/README.md index d4b3ba27..c5d51914 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ When you reach the step for [setting up environment variables](https://shopify.d When hosting your Shopify Remix app on Vercel, Vercel uses a fork of the [Remix library](https://github.com/vercel/remix). -To ensure all global variables are set correctly when you deploy your app to Vercel update your app to use the Vercel adapter instead of the node adapter. +To ensure all global variables are set correctly when you deploy your app to Vercel update your app to use the Vercel adapter instead of the node adapter. ```diff // shopify.server.ts @@ -216,6 +216,7 @@ pnpm run deploy This template registers webhooks after OAuth completes, using the `afterAuth` hook when calling `shopifyApp`. The package calls that hook in 2 scenarios: + - After installing the app - When an access token expires @@ -228,7 +229,7 @@ That will force the OAuth process and call the `afterAuth` hook. Webhooks subscriptions created in the [Shopify admin](https://help.shopify.com/en/manual/orders/notifications/webhooks) will fail HMAC validation. This is because the webhook payload is not signed with your app's secret key. -Create [webhook subscriptions]((https://shopify.dev/docs/api/shopify-app-remix/v1/guide-webhooks)) using the `shopifyApp` object instead. +Create [webhook subscriptions](https://shopify.dev/docs/api/shopify-app-remix/v1/guide-webhooks) using the `shopifyApp` object instead. Test your webhooks with the [Shopify CLI](https://shopify.dev/docs/apps/tools/cli/commands#webhook-trigger) or by triggering events manually in the Shopify admin(e.g. Updating the product title to trigger a `PRODUCTS_UPDATE`). @@ -251,6 +252,19 @@ When you trigger a webhook event using the Shopify CLI, the `admin` object will Webhooks triggered by the CLI are intended for initial experimentation testing of your webhook configuration. For more information on how to test your webhooks, see the [Shopify CLI documentation](https://shopify.dev/docs/apps/tools/cli/commands#webhook-trigger). +### Using Defer & await for streaming responses + +To test [streaming using defer/await](https://remix.run/docs/en/main/guides/streaming) during local development 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 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.