Back

Environment Variables Not Passing Through in Custom Function

  • 0
  • Cloud
sinusrider
27 Jan, 2025, 12:38

I'm working on a custom function in Appwrite, but I'm facing an issue where some environment variables are not passing through correctly.

This occurs whether I trigger the function manually or through a client using: databases..collections..documents.*.create

What I’ve Tried: Checked that all environment variables are correctly defined in the function settings. Verified that they are accessible within other parts of the Appwrite project. Manually triggered the function to see if the issue persists outside of client-side triggers. Examined logs for any errors or missing data. Observations: Some environment variables are available, but others are missing or undefined. This issue occurs regardless of the trigger method. The function is running in Node.js 22.9.0, and I’m using Appwrite 1.6.1.

Please check the end of the log below to see the missing variable I'm referring to.

TL;DR
Developers facing issue with environment variables not passing through correctly in custom function in Appwrite project, causing missing or undefined variables. Issue persists regardless of trigger method. Environment variables verified to be correctly defined and accessible elsewhere in project. Node.js version: 22.9.0, Appwrite version: 1.6.1. Solution: Check for proper setup and handling of all required environment variables in the custom function.
sinusrider
27 Jan, 2025, 12:38

Native logs detected. Use context.log() or context.error() for better experience. Starting audio analysis trigger function... All Environment Variables: APPWRITE_API_KEY: [DEFINED-ANONYMIZED] APPWRITE_VCS_ROOT_DIRECTORY: APPWRITE_VCS_REPOSITORY_ID: 922324856 APPWRITE_FUNCTION_RUNTIME_NAME: Node.js NODE_VERSION: 22.9.0 HOSTNAME: b658da0aaa4c28060e1cfe4992945025 APPWRITE_VERSION: 1.6.1 YARN_VERSION: 1.22.22 APPWRITE_VCS_REPOSITORY_BRANCH_URL: [DEFINED-ANONYMIZED] APPWRITE_VCS_COMMIT_HASH: af7d242a2276fe21293d7afdffe29ff5354e91e1 SHLVL: 5 APPWRITE_AUDIO_COLLECTION_ID: 679286ca00381c6ed109 HOME: /root OLDPWD: /usr/local/server APPWRITE_FUNCTION_CPUS: 1 APPWRITE_VCS_COMMIT_AUTHOR_URL: [DEFINED-ANONYMIZED] OPEN_RUNTIMES_ENV: production APPWRITE_FUNCTION_MEMORY: 512 OPEN_RUNTIMES_HEADERS: {} CYANITE_API_KEY: [DEFINED-ANONYMIZED] OPEN_RUNTIMES_CPUS: 1 APPWRITE_DEPLOYMENT_TYPE: vcs OPEN_RUNTIMES_MEMORY: 512 APPWRITE_VCS_REPOSITORY_BRANCH: main APPWRITE_VCS_COMMIT_AUTHOR_NAME: [DEFINED-ANONYMIZED] APPWRITE_DB_ID: 679286550029ad300dcd PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin APPWRITE_VCS_REPOSITORY_OWNER: [DEFINED-ANONYMIZED] APPWRITE_FUNCTION_NAME: Cyanite_api_request APPWRITE_REGION: fra APPWRITE_ENDPOINT: [DEFINED-ANONYMIZED] APPWRITE_VCS_REPOSITORY_URL: [DEFINED-ANONYMIZED] INERNAL_EXECUTOR_HOSTNAME: exc1 OPEN_RUNTIMES_ENTRYPOINT: src/main.js APPWRITE_FUNCTION_RUNTIME_VERSION: 22 APPWRITE_FUNCTION_ID: 6795663c00271b1663c3 APPWRITE_FUNCTION_API_ENDPOINT: [DEFINED-ANONYMIZED] APPWRITE_VCS_REPOSITORY_NAME: Cyanite_api_request PWD: /usr/local/server APPWRITE_VCS_COMMIT_URL: [DEFINED-ANONYMIZED] OPEN_RUNTIMES_HOSTNAME: exc1 APPWRITE_FUNCTION_DEPLOYMENT: 679767b345af6f175f01 APPWRITE_VCS_COMMIT_MESSAGE: debug main

sinusrider
27 Jan, 2025, 12:38

APPWRITE_FUNCTION_PROJECT_ID: 679283e8000cb489b808 OPEN_RUNTIMES_SECRET: [DEFINED-ANONYMIZED] CYANITE_WEBHOOK_SECRET: [DEFINED-ANONYMIZED] APPWRITE_FUNCTION_EVENT: undefined APPWRITE_FUNCTION_EVENT_DATA: undefined Parsed Event Data: {} Database ID: undefined Collection ID: undefined Document ID: undefined Missing event data; no document created.

sinusrider
27 Jan, 2025, 12:44

The main.js file

sinusrider
27 Jan, 2025, 12:46
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more