Back

function returning same data no matter what

  • 1
  • Functions
Capone
10 May, 2023, 15:00

I have a function that takes inputs and depending on those inputs executes different methods. No matter what I set path1 to, it always returns the same value, which is whatever the value of path1 was when the server function was first executed.

For example, in the attachment - res.send(path1) always returns 63ac838005209fd1b692", even if i change path1 in the createExecution command.

This is resulting in the incorrect method being fired, as each method refers to a different database.

I have tried redeploying the function so am quite stumped as to what is happening.

TL;DR
The user has a function that is not returning the expected data based on different inputs. The function uses `path1` to determine which method to execute, but it always returns the same value, regardless of the input. They have already tried redeploying the function without success. A solution suggested by another user is to use `req.variables` instead of `process.env`. This may address the issue.
Drake
10 May, 2023, 17:51

You should be using req.variables rather than process.env. see https://appwrite.io/docs/functions#writingYourOwnFunction

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