Back

Global variables not available in function in 1.4.1

  • 1
  • Self Hosted
  • Functions
obiwanzenobi
1 Sep, 2023, 00:53

Global variables set in a project are not available to functions executions. Global variables are available during build phase tho

TL;DR
Users are experiencing an issue where global variables are not available in functions in version 1.4.1 of the software. One user suggests deleting and recreating the variable to solve the problem. Another user tries creating a new project and copying the function with the global variable, and it works. It seems that migrated projects are not getting the global variables. One user suggests running the migration, and another user confirms that everything is working fine for them on node 18.0. The suggestion is made to check the project variables in the console. One user provides screenshots to confirm their implementation. The Appwrite version is updated to 1.
Abhishek
1 Sep, 2023, 08:26

Same issue!

Drake
1 Sep, 2023, 15:24

how are y'all executing the function?

obiwanzenobi
1 Sep, 2023, 16:09

Through dart sdk (create execution), I will try to do a execute from console if this will have global variables

Drake
1 Sep, 2023, 17:46

i can confirm the problem and crated an issue: https://github.com/appwrite/appwrite/issues/6113

obiwanzenobi
2 Sep, 2023, 07:35

Cool For everybody who needs it - Workaround for now is to use local function variables.

Abhishek
8 Sep, 2023, 10:07

I updated the Appwrite to 1.4.2 and redeployed the function. But still, Project-level global envs are not available in the functions.

Meldiron
8 Sep, 2023, 10:50

have you ran migration?

Abhishek
8 Sep, 2023, 10:54

Yes

Abhishek
8 Sep, 2023, 10:55
TypeScript
cd appwrite/
docker compose exec appwrite migrate
Drake
8 Sep, 2023, 19:29

so i just tested this and it seemed to work...project level variable is in the environment and variables with a conflict properly get overridden

Abhishek
8 Sep, 2023, 19:54

Attaching the screenshots, just to confirm the implementation from my end. Can you please verify? Runtime: node-18.0

Drake
8 Sep, 2023, 20:02

looking at the project variables in the console, would you please open the editor, switch to the JSON view and share that?

Drake
8 Sep, 2023, 20:03

also, how are you executing the function?

Abhishek
8 Sep, 2023, 20:07

I deployed manually and executing using the Appwrite console

Drake
8 Sep, 2023, 21:14

so i tested again with node 18 and everything seems to be working fine on my end 🧐

Abhishek
9 Sep, 2023, 16:43

Interesting! I just created a new project and copied the same function with Global Variable. It worked! It seems like the migrated Projects are not getting the Global variable or maybe my instance is messed up somehow

Drake
9 Sep, 2023, 16:51

back in your old project, have you tried deleting the variable and recreating it?

Abhishek
9 Sep, 2023, 16:52

Yes, I did

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