Back

context in local development

  • 0
  • Self Hosted
  • Functions
Guille
21 Nov, 2024, 03:10

There is any way to pass vars into a local function?

I'm running a function with the CLI command appwrite run function --function-id

but I can't see any value in context or context.req

and when I log it I see this error: SyntaxError: JSON Parse error: Unexpected EOF

TL;DR
Developers are seeking guidance on passing variables to a local function in the Appwrite platform. They are encountering issues with the context.req object leading to a JSON parse error. The solution is to ensure that the required variables are passed via a .env file as per the documentation.
Steven
21 Nov, 2024, 03:15

Vars are passed via a .env file

Steven
21 Nov, 2024, 03:17

Logging req when there isn't a valid JSON body will throw an error

Guille
21 Nov, 2024, 03:18

I see, I don't have any .env file, this should be documented here right?

https://appwrite.io/docs/products/functions/develop-locally

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