Hi, Is there a way to define globale variable in a project to use it between multiple functions ? For example the variable APPWRITE_FUNCTION_ENDPOINT need to be available for each function we deploy, but we have to declare it in each function...
Hey there 👋 As of right now, you will need to define them manually in each function. Thanfully, in next Functions iteration global variables is a planned feature. I would expect this to be out in Appwrite 1.4. No active work is done yet, bit I plan to start it soon
Ok perfect, glad to see it in the next evolution 👍
And is there a way to define the variable in a local file ( for exemple .env), and then when we deploy with the appwrite-cli, it will initialise all variable coming from this file ?
When using Appwrite CLI, it generates appwrite.json. In there, under function, you can add variables key and put key&value pairs of your variables. With that, every deploy will remove all existing variables and apply variables from appwrite.json.
As defined here under variables https://appwrite.io/docs/command-line-deployment#function-options
Nice, thanks for your answer
Make sure to 👍🏼 this issue to follow along with the progress! https://github.com/appwrite/appwrite/issues/3530
[SOLVED] Function : globale variable
Recommended threads
- [v1.8.1] Getting error "(role: applicati...
... but that scope doesn't exist. I am trying to get a function to run and modify tables in the database dynamically. I set everything up and eventually got: ...
- Scheduled function silently stopped firi...
Function is scheduled `* * * * *` and is `enabled: true`, but Appwrite Cloud has stopped queueing executions. Last execution: **2026-05-30 00:47 UTC** (~46h...
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I can’t fin...