Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
85 stars 9 forks source link

Utility authenticatedFetch from @shopify/app-bridge-utils strips body for POST requests #164

Closed lmartins closed 1 year ago

lmartins commented 1 year ago

Describe the bug

I'm building a Shopify app having started with the Shopify CLI. Included with that install comes a fetch wrapper utility from @shopify/app-bridge-utils that wraps native fetch API so that it includes authentication details with requests using the returning utility.

I'm able to successfully use that for any GET request, but all POST/PUT requests are stripped from the request body.

Is this intended behavior? If so is there a different way to handle POST requests?

Packages and versions

List the relevant packages you’re using, and their versions. For example:

lmartins commented 1 year ago

Please correct me if I'm wrong but looks like this is not being caused by the app-bridge-utils after all, but rather standard behaviour for the Express server.

You need to add another middleware to the endpoints that need to take in body content via POST requests: https://stackoverflow.com/questions/9177049/express-js-req-body-undefined