I’m using the shopify-node-api (v 3.0.1) and trying to make a basic GraphQL call with the following code:
const { Shopify, ApiVersion } = require('@shopify/shopify-api');
Shopify.Context.initialize({
API_KEY:
and getting the error:
> HttpRequestError: Failed to make Shopify HTTP request: FetchError: invalid json response body at [https://test-store.myshopify.com/admin/api/undefined/graphql.json](https://test-store.myshopify.com/admin/api/undefined/graphql.json) reason: Unexpected end of JSON input> > at HttpRequestError.ShopifyError [as constructor] (/truncated-path/node_modules/@shopify/shopify-api/dist/error.js:13:28)> > at new HttpRequestError (/truncated-path/node_modules/@shopify/shopify-api/dist/error.js:79:42)
Note: I've truncated the code paths above to make it easier to read.
Things I've tried that didn't work:
1. As per this post: [InternalServerError with Shopify Node API](https://community.shopify.com/topic/1433922) I tried to set the SHOPIFY_API_VERSION variable to the following values: ApiVersion.July21, ApiVersion.October21, ApiVersion.January22, ApiVersion.April22, ApiVersion.Unstable, '2021-07', '2021-10', '2022-01', '2022-04', 'unstable' but none of them worked
1. I tested the following version of '@shopify/shopify-api': 3.0.1, 3.0.0, 2.1.0 but all of them gave me the same error
1. I put the app into a container and built it with GCP Cloud Build and pushed it to GCP Cloud Run and it gave me the same error as above
1. I tried to run the GraphQL query in [Shopify GraphiQL App](https://beej-test-store.myshopify.com/admin/apps/shopify-graphiql-app) and it works fine
Any ideas on what could be causing this error?
Thanks!