Price Rule Delete Error
Issue summary
When I try to delete Price Rule with Admin API following the documentation mentioned over this link https://shopify.dev/api/admin-rest/2021-10/resources/pricerule#[delete]/admin/api/2021-10/price_rules/{price_rule_id}.json . It deletes my Price Rule from shopify but also through this error Failed to make Shopify HTTP request: FetchError: invalid json response body at https://example.myshopify.com/admin/api/2021-10/price_rules/1058298364037.json reason: Unexpected end of JSON input
Expected behavior
Successful response after deletion of the Price Rule.
Actual behavior
Deletes the Price Rule from Shopify Store but also through invalid json error.
Steps to reproduce the problem
- Delete Price Rule with shopify-node-api (rest)
Reduced test case
Properly handle JSON response data with shopify-node-api
I got same error on deleting recurring application charge.
I got same error on deleting recurring application charge.
Actually, this error occur when Shopify did not return any response and this app handling response with response.json(). According to Shopify Admin API REST its returns nothing 'No Content' on deletion of PriceRule and Coupon.
You can avoid this error by just making some changes to this file node_modules/@shopify/shopify-api/dist/clients/http_client/http_client.js.
replace 169 line : case 0: return [4 /yield/, response.json()]; with this line: case 0: return [4 /yield/, response.status !== 204 ? response.json() : response];
21 May, still not fixed. Do everyone has to waste 5 hours for just to learn this?
@xiddixaid Thank you.
It's nuts this lib has such a basic bug :facepalm:
This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.
This is still an issue. Experiencing it as well.
This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.
We are closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines
Thank you!