Rank 2: Process
In the new functions, req.variables['APPWRITE_FUNCTION_API_KEY'] doesn't work anymore. So I switched to the new syntax. But I still get the following error:
TypeError: Cannot read properties of undefined (reading 'APPWRITE_FUNCTION_ENDPOINT')
at /usr/local/server/src/function/src/index.js:19:31
The ENV Var is added in the Console.
This is my code:
...
if (
!({}).APPWRITE_FUNCTION_ENDPOINT ||
!({}).APPWRITE_FUNCTION_API_KEY
) { return ... }
...
This also gives my some type errors in my IDE:
Property 'APPWRITE_FUNCTION_ENDPOINT' does not exist on type '{}'.
Considering that Functions are supposed to support Typescript soon, I find the current implementation a bit questionable.
So,
- How can I fix my function to find the Env Var?
- How can I tell VSCode to not give me type errors?
Kind regards,
Marius