Need help with the following error

Topic summary

A user encounters a TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' when trying to construct a GraphQL endpoint using shopify.ShopifyResource.get_site() + "/graphql.json".

Initial diagnosis: The error suggests get_site() is returning None instead of a string, preventing string concatenation.

Code context: The issue occurs within the shopify-python library’s GraphQL class initialization, specifically when setting self.endpoint.

Proposed solution: A community member suggests creating two separate Shopify Shop instances—one for queries and another for mutations. They report that using the same instance for both operations triggers this error, while using distinct instances resolves it.

Status: The discussion remains open, awaiting confirmation from the original poster on whether the suggested workaround resolves their issue.

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

self.endpoint = shopify.ShopifyResource.get_site() + “/graphql.json”
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘str’

Looks like your “shopify.ShopifyResource.get_site()” function is returning something that isn’t a String, what is that function returning?

Actually it is a library error

import shopify
from ..base import ShopifyResource
from six.moves import urllib
import json

class GraphQL:
def init(self):
self.endpoint = shopify.ShopifyResource.get_site() + “/graphql.json”
self.headers = shopify.ShopifyResource.get_headers()

def merge_headers(self, *headers):
merged_headers = {}
for header in headers:
merged_headers.update(header)
return merged_headers

def execute(self, query, variables=None):
endpoint = self.endpoint
default_headers = {“Accept”: “application/json”, “Content-Type”: “application/json”}
headers = self.merge_headers(default_headers, self.headers)
data = {“query”: query, “variables”: variables}

req = urllib.request.Request(self.endpoint, json.dumps(data).encode(“utf-8”), headers)

try:
response = urllib.request.urlopen(req)
return response.read().decode(“utf-8”)
except urllib.error.HTTPError as e:
print((e.read()))
print(“”)
raise e

"This is code of the shopifyapi library and it belongs to graphql.py portion "

Hello there, as the question is still not marked as solved:

I also stumbled upon this problem while I was trying to bulk update my inventory. I think I have a simple solution to this.

For me, the code was executing properly when I made two different Shopify Shop instances for query and mutation. However, at the very moment I tried to use the same instance for query and mutation, all of a sudden the same functions that were working well, started to show me this error.

So my suggestion is to make sure that you have at least two different instances of your Shopify shop and you are using one of them for query and another for mutation.

Let me know if it helps.

Thank you.