donutdan4114 / shopify

Shopify PHP SDK to easily interact with the Shopify API.
85 stars 39 forks source link

Calling GraphQL endpoint throws exception on API limit checks #19

Open nikemeal opened 6 years ago

nikemeal commented 6 years ago

When calling the GraphQL endpoint (/admin/graphql.json) it'll throw an exception when trying to work out the number of API calls made/left in Client.php on the first line of this function: protected function setCallLimitParams() { $limit_parts = explode('/', $this->last_response->getHeader(self::CALL_LIMIT_HEADER)[0]); $this->call_limit = $limit_parts[0]; $this->call_bucket = $limit_parts[1]; } with the error

Undefined offset: 0 due to the way GraphQL returns data. Commenting out the checks for API limits allows it to work, but then means call rate limiting is redundant