It may be that I am using the wrong method to send variables to the server functions, but if I create execution with one value, and then again with a different value, the function fires with the original value and not the new one.
I have attached a screenshot of how I am getting the variables from the execution.
Thanks
Summary
The user had a server function that was caching variables and causing issues. They received some advice on using `req.payload` instead of `process.env`. They were also advised to avoid using `then` and instead use `async/try/await/catch`. They mentioned that the function was returning the wrong `listid` and that running the function with different values still resulted in the function using the original value. The user also mentioned that they changed some code to use a space instead of `$` but the function was still using `$` instead. The solution was not explicitly stated in the thread.
Capone
Rank 2: Process
Jun 28, 2023, 15:09
In addition, I have changed code in the function to create a string seperated by "$" to use a " " instead, however the function is still creating strings using "$", so the old code.
Drake
Jun 28, 2023, 15:28
How are you executing your function?
Drake
Jun 28, 2023, 15:28
btw, you should probably only parse once 😜
Capone
Rank 2: Process
Jun 28, 2023, 15:38
You are right, I have changed that now!
Capone
Rank 2: Process
Jun 28, 2023, 15:39
Also noticed I have sent the wrong function, that one is working fine, This is the one I am having issues with
Capone
Rank 2: Process
Jun 28, 2023, 15:52
Capone
Rank 2: Process
Jun 28, 2023, 15:53
Then this is how it is excecuted
Capone
Rank 2: Process
Jun 28, 2023, 15:53
Capone
Rank 2: Process
Jun 28, 2023, 15:54
If I run the function shortly after each other but with different listid, the function will execute with the first listid, and therefore cause an issue as the document already exists, despite the second listid being sent as the value
Capone
Rank 2: Process
Jun 28, 2023, 15:55
Capone
Rank 2: Process
Jun 28, 2023, 15:56
you can see here the listid sent is the one on ln 267, but the function returns the wrong listid
Drake
Jun 28, 2023, 17:21
Btw, I highly advise against using then. It's much clearer to just using async/try/await/catch
Drake
Jun 28, 2023, 17:22
Can you try to use req.payload instead of process.env?
Capone
Rank 2: Process
Jun 28, 2023, 21:00
Ah perfect, that seems to be working now. Thanks for the help!