HTTP request, "impersonate a user" dynamic usage error

Describe the problem/error/question

I a http request node, I use a Google service account API credential type.
I need the “Impersonate a User” field to be dynamic, pulling data from the “email” field in the previous node.

What is the error message (if any)?

The request fails each time (401) because of this.
It seems impossible to access the previous node from this field, while the data is here. Even the interface displays an error message (see screens):

I tried to reproduce the same request by using a raw email in the field and it works.
I also tried to use the complete syntax with the node name in case it would have been a confusion with $json:

And I updated the request node to the last version available in my current n8n version: 4.2.

Information on your n8n setup

  • n8n version: 1.42.1
  • self-hosted mode on aws with Fargate (docker)
  • using RDS Postgres and EFS for storing n8n data

Thank you for your help

1 Like

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:

As I understand it, service connections don’t “exist” within your workflow, they are global. So it may be able to “glitch” seem like it can access the data from nodes sometimes, but I don’t think this is officially possible or designed to handle this.

I was going to suggest global variables as self hosted, but those are read-only.

You might be able to use this API mid-run:

Or maybe something like this, but still might not work since I am not sure how connections would handle workflow data itself.

You may be able to edit the credential via API live, but doesn’t seem like there is an endpoint to edit, only create or grab. Maybe you can check if they enabled PATCH or PUT by accident, (try patch instead of post to create new, if enabled it should only update the existing record) :wink:

Justin - thinkbot.agency

1 Like

Hello Justin,

Thank you a lot for your answer. Actually, now I’ve a bit of history with this workflow, it works as I set it, even if n8n returns an error :eyes:
So I guess I’ll let it like this and ignore errors.

Otherwise I guess the best solution would be to use variables and modify them for each request.

Thank you for your help!

2 Likes

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