Critical: this.helpers.getCredentials not a function on macOS ARM64 (Apple Silicon) w/ Docker

Hi n8n Community,
I’m encountering a persistent and critical issue where this.helpers.getCredentials is not available as a function within the Code node on my macOS ARM64 (Apple Silicon) machine using Docker. This prevents me from programmatically accessing any credentials, which is essential for my workflows.
Core Problem:
Inside a Code node (Mode: Run Once for All Items, Language: JavaScript), attempting to call await this.helpers.getCredentials(“MyCredentialName”) results in a TypeError: this.helpers.getCredentials is not a function.
However, typeof this.helpers correctly evaluates to “object”. This means the helpers object itself is present, but the getCredentials method is missing or not a function on it.
CRITICAL DIAGNOSTIC FINDING:
This issue occurs consistently even when running n8n with a completely fresh, empty data directory (meaning a new database.sqlite and a new config file are generated by n8n).
The problem has been reproduced across multiple n8n versions, including:
1.92.2 (which I observed as the latest)
1.90.0
1.80.0
This strongly suggests the issue is not related to my n8n data/database corruption or a bug in a single n8n point release, but rather an environmental problem with my specific setup.
My Environment Details:
macOS Version: Sequoia 15.5
Mac Hardware: M2 MacBook Air
Docker Desktop Version: 4.41.2 (191736)
n8n Versions Tested (Self-Hosted via Docker Compose): 1.92.2, 1.90.0, 1.80.0
My docker-compose.yml (used for the fresh data directory tests):
yamlservices:
n8n:
image: n8nio/n8n:1.93.0 # Also tested with 1.92.2, 1.90.0, etc.
container_name: n8n_community_debug_test
restart: unless-stopped
ports:
- “5678:5678”
environment:
- N8N_ENCRYPTION_KEY=MY_VERY_SECRET_AND_PROPERLY_SET_KEY # Key is correctly set
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
# - TZ=Pacific/Auckland # My timezone
volumes:
- ./n8n_fresh_data_test_volume:/home/node/.n8n # This was a new, empty directory for each fresh test
(Note: I confirmed the N8N_ENCRYPTION_KEY is correctly set and a new config file is generated without “mismatch” errors on fresh starts.)
Code Node Test Script Used (on fresh setup):
javascript// Test this.helpers.getCredentials in a fresh environment
let credentialData = null;
let errorMessage = ‘No error’;
let helpersType = typeof this.helpers;
let getCredentialsType = ‘this.helpers is not an object’;

// Log to n8n server console for easier debugging
console.log(‘N8N_COMMUNITY_TEST - Starting test…’);
console.log(‘N8N_COMMUNITY_TEST - Type of this.helpers:’, helpersType);

if (helpersType === ‘object’ && this.helpers !== null) {
getCredentialsType = typeof this.helpers.getCredentials;
console.log(‘N8N_COMMUNITY_TEST - Type of this.helpers.getCredentials:’, getCredentialsType);

if (getCredentialsType === ‘function’) {
try {
console.log(‘N8N_COMMUNITY_TEST - Attempting to get MyFreshTestCredential’);
// Assumes a dummy credential named “MyFreshTestCredential” was created for the test
credentialData = await this.helpers.getCredentials(“MyFreshTestCredential”);
console.log(‘N8N_COMMUNITY_TEST - Fetched credential data:’, JSON.stringify(credentialData, null, 2));
} catch (error) {
console.error(‘N8N_COMMUNITY_TEST - Error during getCredentials call:’, error);
errorMessage = error.message;
}
} else {
errorMessage = 'this.helpers.getCredentials is NOT a function. Type is: ’ + getCredentialsType;
}
} else {
errorMessage = 'this.helpers object is not defined or not an object. Type is: ’ + helpersType;
}

console.log(‘N8N_COMMUNITY_TEST - Test finished. Error message (if any):’, errorMessage);

return [{ json: {
test_ran_fresh_setup: true,
helpers_object_type: helpersType,
get_credentials_function_type: getCredentialsType,
retrieved_credential_data: credentialData,
error_message_if_any: errorMessage,
timestamp: new Date().toISOString()
} }];
Output from the Code Node Test (on fresh setup with a dummy “MyFreshTestCredential”):
json{
“test_ran_fresh_setup”: true,
“helpers_object_type”: “object”,
“get_credentials_function_type”: “undefined”,
“retrieved_credential_data”: null,
“error_message_if_any”: “this.helpers.getCredentials is NOT a function. Type is: undefined”,
“timestamp”: “[YOUR_TIMESTAMP_HERE]”
}
(The console.log messages in the n8n server logs also confirm these types.)
n8n Server Startup Logs (for fresh setup):

The startup logs are clean after setting the encryption key and N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true.
All database migrations complete successfully.
n8n reports “ready on 0.0.0.0, port 5678”.
There are no errors related to encryption, database access, or credential loading during startup.
(The only persistent messages are unrelated [license SDK] cert is invalid… warnings, which I understand are generally benign for community edition).
Additional Important Detail:
The global $workflow object is defined and accessible in the Code node, indicating that the basic execution context seems to be partially working. The issue appears specific to this.helpers and its getCredentials method.
Summary of Troubleshooting Steps Taken:
Ensured N8N_ENCRYPTION_KEY is correctly set in docker-compose.yml.
Resolved initial “Mismatching encryption keys” error by deleting the old config file when starting with a new/correct key.
Set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true, which successfully corrected config file permissions according to n8n’s startup logs.
The core issue (this.helpers.getCredentials not being a function) persists across multiple n8n versions and with completely fresh/empty n8n_data directories.
My Goal:
I need to be able to use this.helpers.getCredentials() in a Code node to securely access credential values for my automation workflows (e.g., for setting custom headers in API calls).
Could this be a known issue with n8n on macOS ARM64 Docker environments, or is there any further diagnostic I can perform to help pinpoint why this.helpers.getCredentials is not being correctly initialized?
Any assistance would be greatly appreciated, as I’m currently blocked from using credentials effectively.
Thank you!

1 Like

Hi, have u tried to enable


have u got this enabled on the m1?

Thankyou for your reply. It’s an M2 Macbook, and I’ve checked that the right VMM was already set. Have now tested with Docker VMM as well, same result.

hm could you share workflow plz, can try see if I get similar issue

n8n attach workflow

thanks :slight_smile:

My attempts to paste the code are being blocked

1 Like

am really not sure atm, hoping someone else may see, quite odd issue tbh