App reviews, troubleshooting, and recommendations
Hi, I'm using Shopify's Remix App Template, and have setup a webhook for products updated. I want it to send the updated product to my backend server. However I'm having some issues doing so.
I get this error:
15:42:55 │ remix │ PRODUCTS_UPDATE error: SyntaxError: Unexpected token 'o', "[object Rea"... is not valid JSON
and:
Request.body: ReadableStream { locked: true, state: 'closed', supportsBYOB: false }
Here is my case for product update:
case 'PRODUCTS_UPDATE': console.log('PRODUCTS_UPDATE case called.'); console.log('PRODUCTS_UPDATE called.'); if ( !request.body ) { console.log('PRODUCTS_UPDATE request.body is null.', request.body); break } try { const product = JSON.parse(request.body.toString()); console.log('PRODUCTS_UPDATE product:', product); const response = await axios.post( `${API_DOMAIN}/products/update`, { store_url: shop, product: product }, { headers: { 'Content-Type': 'application/json', }, }, ); }catch (error: unknown) { console.log('PRODUCTS_UPDATE error:', error) console.log("Request.body: ______" ,request.body, "______ REQUEST: ______", request, "______"); }break;
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024