Back

TypeError: Cannot read property 'APPWRITE_FUNCTION_EVENT_DATA' of undefined

  • 0
  • Functions
mriskygwan
25 Feb, 2023, 10:49

I got this error from a function that is triggered by an event. was working fine when I was in version 0.15.3. please assist.

TL;DR
The user is experiencing a TypeError with their code. They are trying to read a property called 'APPWRITE_FUNCTION_EVENT_DATA', but it is undefined. The user is also asking for help with their code.
Drake
25 Feb, 2023, 16:20

What's your code?

mriskygwan
26 Feb, 2023, 04:47
TypeScript

module.exports = async function (req, res) {
  const client = new sdk.Client();
  const payload = JSON.parse(req.env.APPWRITE_FUNCTION_EVENT_DATA);
  }
Drake
26 Feb, 2023, 05:04

Weird...this should work...can you print req.env?

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