woocommerce / woocommerce/wc-api-php

Product update: cURL Error: HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

Open
#335 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
PHP
Stars
546
Forks
158
Avg merge
3h 21m
Merged PRs (30d)
2

Description

This happens on api call on endpoint for product update.
It's fixed by setting a different http version via curl_setopt

in file src/WooCommer/HttpClient/HttpClient.php after line 355
\curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);

or better calling runtime not to break vendor package in you calls
$api = new Client($url, $consumerKey, $consumerSecret, [$version]); $api->http->setCustomCurlOptions([ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ]);

of course it's an hotfix and it should be refactored probably

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/WooCommer/HttpClient/HttpClient.php around line 355 and inspect how curl options are configured for product-update API calls. Compare the proposed CURLOPT_HTTP_VERSION setting with the Client and setCustomCurlOptions entry point. Done means the product update no longer triggers the reported HTTP/2 protocol error while the intended option configuration remains clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.