_Command failed: pnpm install --prefer-offline --ignore-scripts -P_

This topic was automatically generated from Slack. You can find the original thread here.

Hey everyone :wave:

I’m encountering a critical issue in my flow, specifically related to an error I’ve been receiving.

Error
FATAL: Cannot write to OAuth cache dir /home/sbx_user1051/.camunda If you are running on AWS Lambda, set the HOME environment variable of your lambda function to /tmp

I added the variable HOME= /tmp

But still, get this error.

Let’s see if Pi can help here

Hey everyone :wave:

I’m encountering a critical issue in my flow, specifically related to an error I’ve been receiving.

Error
FATAL: Cannot write to OAuth cache dir /home/sbx_user1051/.camunda If you are running on AWS Lambda, set the HOME environment variable of your lambda function to /tmp

I added the variable HOME= /tmp

But still, get this error.

It looks like you’re encountering an issue with writing to the OAuth cache directory in your AWS Lambda function. The error message suggests setting the HOME environment variable to /tmp, which you’ve already done. However, you’re still experiencing the error. Here are a few steps you can take to troubleshoot and resolve this issue: 1. Verify Environment Variable Configuration: Ensure that the HOME environment variable is correctly set in your Lambda function configuration. Double-check the spelling and value to make sure there are no typos. 2. Check Permissions: Verify that your Lambda function has the necessary permissions to write to the /tmp directory. The /tmp directory is the only writable directory in AWS Lambda, and it should have the necessary permissions by default. 3. Update Code to Use /tmp: Ensure that your code is correctly referencing the HOME environment variable and using the /tmp directory for writing the OAuth cache. Here’s an example of how you can set the HOME environment variable in your Lambda function code: process.env.HOME = '/tmp'; 4. Debugging: Add some debugging statements to your code to log the value of the HOME environment variable and the directory where the OAuth cache is being written. This can help you identify if there are any issues with the path being used. 5. Check Lambda Execution Role: Ensure that the IAM role associated with your Lambda function has the necessary permissions to write to the /tmp directory. Although this should be allowed by default, it’s worth double-checking. If you’ve tried all these steps and are still encountering the issue, you may want to reach out to the Pipedream support team for further assistance. You can visit Support - Pipedream for more support options. If you have any additional details or specific code snippets related to your Lambda function, please share them, and I can provide more targeted assistance.

what’s the code snippet you’re using to write to /tmp?

Hey Andrew, I suppose that is an authorization key by Camunda. I launched code with SDK and it try to write key in the home folder for me

Are you able to explicitly overwrite the write path to somewhere in /tmp ?

Yes,

I have found in docs this option

const c8 = new Camunda8({
CAMUNDA_TOKEN_CACHE_DIR: ‘/tmp/cache’,
})

Works

Thank you for your time

Awesome, glad to hear!

Posted thread to Discourse: Why does the "FATAL: Cannot write to OAuth cache dir" error still occur in AWS Lambda even after setting HOME environment variable to /tmp?