What exactly was the trace?
Did you see the execution start in the Appwrite console?
Votes
0
Replies
24
Participants
Unknown
Messages
25
What exactly was the trace?
Did you see the execution start in the Appwrite console?
Rank 1: Thread
sorry, I have deleted the function and rewrote it using the Deno SDK.
But what does happen on every script I write is, if it throws and error, I will see only an "Internal Server Error" message in the Error tab of the appwrite function's dashboard.
Rank 1: Thread
for the error I was having the error message was empty. The only information I had was that it happened in the function that tries to make a request to execute the function I requested in the appwrite's api.
Rank 1: Thread
gonna create a function to reproduce the issue for ya
Rank 1: Thread
it didn't work with the Deno's SDK either though, I had to do a workaround that would cost me more one request xD
Rank 1: Thread
Just an example
Rank 1: Thread
sorry for taking too long
Rank 1: Thread
/* 'req' variable has: 'headers' - object with request headers 'payload' - request body data as a string 'variables' - object with function variables
'res' variable has: 'send(text, status)' - function to return text response. Status code defaults to 200 'json(obj, status)' - function to return JSON response. Status code defaults to 200
If an error is thrown, a response with code 500 will be returned.*/export default async function (request: any, response: any) { throw new Error( 'Environment variables are not set. Function cannot use Appwrite SDK.', )}Rank 1: Thread
and this is what I get in the errors tab
Rank 1: Thread
if I don't catch the error and send it in the response, I'll have no idea of what went wrong xD
For now, it's best to always make sure you catch exceptions and return a response
How did you initialize and deploy your function?
Rank 1: Thread
appwrite init function
Rank 1: Thread
appwrite deploy function
Rank 1: Thread
one important thing I gotta ask you though is: do you know why the headers variable may be empty?
Rank 1: Thread
I tried Deno and PHP SDK's
Rank 1: Thread
I always get an empty array
Yes, they're always empty
Rank 1: Thread
I created a function to receive updates from Stripe webhook but I need the stripe-signature header to confirm the message belongs to Stripe
Rank 1: Thread
mmm
Rank 1: Thread
guess I gonna need to attach it to the body in the proxy layer then
Yes. Here's one that does that: https://github.com/BoolCode/appwrite-funcover
Rank 1: Thread
yeah, I just saw yours after creating mine XD https://github.com/ssa-web-solutions/appwrite-functions-proxy
Not as professional as yours but works (it's lacking an auth layer though)
This isn't mine btw. It's made by byawitz. Mine isn't as good 😅
Rank 1: Thread
XD