Google analytics node returning code.toUpperCase is not a function

Hi,

First of all, thanks for everything. I’ve been using n8n for a short while but it’s very nice and super powerful.

So I just have this workflow with one google analytics node, the credentials work reasonably well. I’ve used them for a google sheet node but I might need to change a few things in the console to get those completely right. This being said the error I get when I run the node seems unrelated to credentials.

If you have any ideas or want to look into that…

Thanks and have a good day

What is the error message (if any)?

code.toUpperCase is not a function

Share the output returned by the last node

{
  "errorMessage": "code.toUpperCase is not a function",
  "errorDetails": {},
  "n8nDetails": {
    "n8nVersion": "1.45.1 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "TypeError: code.toUpperCase is not a function",
      "    at NodeApiError.setDescriptiveErrorMessage (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/errors/abstract/node.error.js:100:40)",
      "    at new NodeApiError (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/errors/node-api.error.js:137:46)",
      "    at Object.googleApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Analytics/v2/transport/index.js:40:23)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Analytics/v2/actions/report/get.ga4.operation.js:553:25)",
      "    at Object.router (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Analytics/v2/actions/router.js:46:36)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Analytics/v2/GoogleAnalyticsV2.node.js:16:16)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:664:51",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1079:20"
    ]
  }
}

Information on your n8n setup

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

hello @MarcD

Can you provide the code sample where you are receiving that error?

Hi barn4k,

Thanks for looking into this.
I’m not sure how i could provide the code sample. The workflow is just like this:

Please let me know if I should look up something extra and provide more info

Ah, I see.

Seems like an issue with n8n. Somehow it didn’t retrieve the error code

@Jon or @netroy for visibility

Hello, we are having the same problem.

Even though there is no type of extra node, and with all the correct configurations.

Hi. I’m also getting this error.


Can’t het report from Google analytics

This sounds like somewhere in the Google Analytics node’s code an error is being created that looks like an http response error, but the code property on it is not a string. This would be hard for us to fix without being able to reproduce it on our own, so I’ve created a custom docker image n8nio/n8n:debug-49037 with this commit, which should now handle this case better, but also log to the container logs the value of code that’s causing this issue.

Can one of you please test out this custom image, and let us know if this fixes the issue for you? it would be additionally helpful if you can share any lines from n8n logs starting with invalid error code :pray:

1 Like

Well it seems to work for me.
The date is just a string like YYYYMMDD but it does connect and get answers

[ { "date": "20221214", "sessions": "131", "totalUsers": "55", "screenPageViews": "1313", "userEngagementDuration": "72115" }, { "date": "20221019", "sessions": "129", "totalUsers": "53", "screenPageViews": "1179", "userEngagementDuration": "113272" }, { "date": "20221025", "sessions": "128", "totalUsers": "67", "screenPageViews": "642", "userEngagementDuration": "22208" }, { "date": "20221202", "sessions": "128", "totalUsers": "65", "screenPageViews": "1024", "userEngagementDuration": "48779" },

Thanks for looking into it!!

Where exactly do you plug in this commit in your workflow?

New version [email protected] got released which includes the GitHub PR 10371.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.