Fatal error: Uncaught TypeError: Key material must be a string, resource, or OpenSSLAsymmetricKey

Topic summary

A developer is encountering a fatal error when attempting to connect to Shopify’s GraphQL API: \

Summarized with AI on November 7. AI used: claude-sonnet-4-5-20250929.

Hi

I am trying in vain to connect to the API using GraphQL as it seems other methods I use that do connect won’t allow me to do an update to a product.

Here is my code

$headers = array(
    "api_version" => "2024-07",
    "X-Shopify-Access-Token" => $this->accessToken,
    "Authorization" => "Bearer $this->accessToken"
);

$cookies = array();
$isOnline = true;

$session = \Shopify\Utils::loadCurrentSession(
    $headers,
    $cookies,
    $isOnline
);

$client = new Shopify\Clients\Graphql(
    $session->getShop(),
    $session->getAccessToken()
);

which just returns this error

Fatal error: Uncaught TypeError: Key material must be a string, resource, or OpenSSLAsymmetricKey in /Users/xxxxxx/Sites/MCMS/vendor/firebase/php-jwt/src/Key.php:31

Really struggling, lots of posts on this all with conflicting information, the documentation does not explain what is required in the $headers array or the $cookies array