Issues with GraphQL Node

Describe the problem/error/question

I am trying to use the Graphql node to send queries/mutations to shopify but keep getting errors. I have even tried copying exactly from n8n templates, but keep getting the error message.

What is the error message (if any)?

TypeError: _a.map is not a function at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/GraphQL/GraphQL.node.js:462:101) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:725:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:673:51 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1085:20

Please share your workflow

Information on your n8n setup

  • n8n version:
    I have tried the node both on a cloud hosted version of the software, and on my own self hosted version. The self hosted version uses all default settings and is hosted on Digital Ocean.

I get the same error on both instances.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Welcome to the community @Ben_Vainer :tada:
I think the error you’re seeing occurs when you try to call .map() on something that isn’t an array. Can you try changing the files input into an array instead of an object in the variables?

{
  "files": [
    {
      "alt": "Ben",
      "contentType": "IMAGE",
      "filename": "Ben",
      "originalSource": "https://teecommercecabot.myshopify.com/cdn/shop/files/CH_Spire_180x180_4824f432-59d0-4010-8826-e39b637c2eb1_110x.png?v=1721942398"
    }
  ]
}

{
  products(first: 5) {
    edges {
      node {
        id
      }
    }
  }
}

response.errors?.map is not a function

1 Like

n8n version

1.64.3 (Self Hosted)

Stack trace

TypeError: response.errors?.map is not a function at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/GraphQL/GraphQL.node.js:461:54) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:722:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:711:51 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1141:20

Yupp, getting the same error when running function and this error shows up when building the query

Unexpected token 'q', "query {
  "... is not valid JSON"`

even while using the exact same query as mentioned in their examples API queries data from GraphQL | n8n workflow template

Changing the response format to string has a different outcome but doesn’t solve the issue

image

Encounter same error, in my case it happen when I am trying to use Shopify Admin API , but it works fine using storefront api, but I need to update my product variants I really need to use Shopify Admin API, is there anyone finds a workaround to this issue ?