Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete application recurring charge is not working for the node lib #760

Closed
5 tasks done
yovasx2 opened this issue Mar 7, 2024 · 3 comments · Fixed by #847
Closed
5 tasks done

Delete application recurring charge is not working for the node lib #760

yovasx2 opened this issue Mar 7, 2024 · 3 comments · Fixed by #847
Assignees

Comments

@yovasx2
Copy link

yovasx2 commented Mar 7, 2024

Issue summary

Delete application recurring charge is not working for the node lib

Before opening this issue, I have:

  • Upgraded to the latest version of the package
    • @shopify/shopify-api version: @shopify/shopify-api@9.3.0
    • Node version: 18.4
    • Operating system: MacOS Sonoma 14.3.1 (23D60)
  • Set { logger: { level: LogSeverity.Debug } } when calling shopifyApi(), if applicable
  • Found a reliable way to reproduce the problem that indicates it's a problem with the package
  • Looked for similar issues in this repository
  • Checked that this isn't an issue with a Shopify API

Getting:

Error cancelling plan: FetchError: invalid json response body at 
https://idpartner-test.myshopify.com/admin/api/2024-01/recurring_application_charges/32169951552.json reason: Unexpected end of JSON 
input
15:27:35 │ web-backend  │     at /Users/yovasx2/shopify/idpartner/web/node_modules/node-fetch/lib/index.js:273:32
15:27:35 │ web-backend  │     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
15:27:35 │ web-backend  │   type: 'invalid-json'
15:27:35 │ web-backend  │ }

While using the https://shopify.dev/docs/api/admin-rest/2024-01/resources/recurringapplicationcharge#delete-recurring-application-charges-recurring-application-charge-id endpoint
like showed in the node example:

// Session is built by the OAuth process

await shopify.rest.RecurringApplicationCharge.delete({
  session: session,
  id: 455696195,
});

It's used via shopify-app-express with version 4.1

Expected behavior

HAve no error
What do you think should happen?
cancel and return

Actual behavior

gets a parsing error due to empty json returned

What actually happens?
returns an error

Steps to reproduce the problem

  1. create subs
  2. tried to delete it

Debug logs

// Paste any relevant logs here
@matteodepalo
Copy link
Contributor

Hi @yovasx2, this looks like an API issue, that endpoint should be returning a valid json response. We've passed it on internally.

@djgundrum
Copy link

djgundrum commented Apr 8, 2024

Is there a status update here? This is an issue for all delete requests. Any resource you try to call shopify.rest.RESOURCE.delete(...) it will throw an error because of an "invalid-json" parse

seems like a one line change

@paulomarg paulomarg transferred this issue from Shopify/shopify-api-js Apr 11, 2024
@paulomarg
Copy link
Contributor

Hey folks, thanks for your patience. We re-evaluated this issue, and it seems that it happens enough that we should handle this scenario in the library. We'll look into it while the issue isn't addressed in the API itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants