joshrps / laravel-shopify-API-wrapper

Interface designed for Shopify apps created with Laravel
MIT License
93 stars 48 forks source link

ERROR #22: The requested URL returned error: 411 Length Required #33

Open eliranm opened 6 years ago

eliranm commented 6 years ago

On some of the stores which install our app (not all of them), we get the following error once we try to call recurring charge activation with activate.json.

The call we make in the code is this:

      $confirm_payment = $shopify->call([
          'METHOD' => 'POST',
          'URL' => '/admin/recurring_application_charges/' . $charge_id . '/activate.json'
      ]);

Any ideas?

Thanks

jeremynikolic commented 6 years ago

I've looked up your issue as I plan on using this wrapper and found this post on shopify forums: URL HERE

It is known requirement of some API requests and the solution seems to be provided at the end of the feed

lomse commented 6 years ago

Adding 'Content-length: 0'; to the $defaultHeaders[] in the laravel-shopify-API-wrapper/src/RocketCode/Shopify/API.php seems to fix the issue.Trying to push a PR but I'm getting access denied.

amandasaffer commented 6 years ago

Also getting this error now when I try to post to the /orders/{orderID}/fulfillments/{fulfillmentId}/complete.json endpoint. Can we accept the PR for this please?

Update: I've tried to manually add the Content-length: 0 header per the documentation but it does not work. I manually edited the api.php file as @Lomse suggested and that worked.

eliranm commented 6 years ago

@amandasaffer How did you manage to make the change manually? We are referenci g it from composer, so we get the source only. Any advice will be appriciated! Thanks

lomse commented 6 years ago

@eliranm Check the src/RocketCode/Shopify/API.php file line 223 in the vendor folder. However the issue should be fixed now. Just update your dependencies and you should be fine :)