Google Service Account signJwt() Returning Null Despite Successful Credential Test (v1.86.1 Cloud)

Hi everyone,

I’m encountering a persistent issue trying to authenticate to Google Cloud using a Service Account credential on n8n Cloud (v1.86.1) and would appreciate any insights the community might have.

My Goal:
To obtain a GCP access token using a Service Account credential (Google Service Account API type) in order to make calls to the Vertex AI API.

The Problem:
My credential, named GCP Vertex AI Key, tests successfully within the n8n Credentials UI (“Connection tested successfully”). However, when I use the standard expression to generate the JWT assertion within my workflow, the function appears to return null.

Troubleshooting Steps & Setup:

  1. Credential Check: The GCP Vertex AI Key (type Google Service Account API) tests successfully.

  2. Key Regeneration: I have regenerated the service account key file in GCP and carefully updated the “Service Account Email” and “Private Key” fields in the n8n credential. The credential continues to test successfully after the update.

  3. Direct HTTP Request Failure: Initially, using the expression directly in the assertion field of the HTTP Request node (targeting https://oauth2.googleapis.com/token with Form-Urlencoded body) failed with a 400 “Missing required parameter: assertion”, suggesting the expression wasn’t evaluating correctly in that context.

  4. Set Node Test: To isolate the issue, I added a Set node (Prepare Assertion) just before the HTTP Request node (Get GCP Auth Token).

  1. Set Node Result: This Prepare Assertion node runs successfully without error , but when I inspect its JSON output, the value is “jwt_assertion”: null .

  2. HTTP Request Node Config: The Get GCP Auth Token node is configured to use the output from the Set node:

  • Method: POST

  • URL: https://oauth2.googleapis.com/token

  • Body Content Type: Form-Urlencoded

  • Body Parameters:

    • grant_type: urn:ietf:params:oauth:grant-type:jwt-bearer

    • assertion: {{ $json.jwt_assertion }}

  1. HTTP Request Node Failure: Predictably, this node fails with the 400 “Missing required parameter: assertion” because the $json.jwt_assertion it receives is null.

GCP Configuration Verified:

  • The Service Account (n8n-vertex-ai-user@…) is enabled in GCP.

  • The relevant Service Account Key is active.

  • The Service Account has the Vertex AI User role assigned in the project IAM settings.

  • The IAM Service Account Credentials API and Vertex AI API are enabled in the GCP project.

My Question:
Has anyone else experienced the $credentials[“Credential Name”].signJwt(…) function returning null even when the credential itself tests successfully and the GCP setup seems correct? Is this a known issue, perhaps with n8n Cloud v1.86.1, or is there another configuration aspect I might be missing? Any suggestions for further debugging would be greatly appreciated!

Environment:

  • n8n Version: 1.86.1

  • Hosting: n8n Cloud

  • Workflow ID (if relevant): 4lhWVo6GxWAQF8bL

Thanks in advance for any help!