What exactly was the trace?
Did you see the execution start in the Appwrite console?
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.
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.
gonna create a function to reproduce the issue for ya
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
Just an example
sorry for taking too long
/*
'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.',
)
}
and this is what I get in the errors tab
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?
appwrite init function
appwrite deploy function
one important thing I gotta ask you though is: do you know why the headers variable may be empty?
I tried Deno and PHP SDK's
I always get an empty array
Yes, they're always empty
I created a function to receive updates from Stripe webhook but I need the stripe-signature header to confirm the message belongs to Stripe
mmm
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
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 😅
XD
Recommended threads
- Cannot set custom domain for appwrite fu...
I dont really know why but certificates creation failed in Cloud probably because of the CNAME to `cloud.appwrite.io` Im getting this error when accessing to my...
- How to include .env
Hello! I am trying to include an env. variable, but the execution fails. Do you have any idea what is wrong? ``` async def process_file(file): ...
- Failed to auto generate functions certif...
I have a self hosted appwrite instance on my server. DNS configuration on my domain registrar : A appwrite.domain.com <my_server_ip> A *.functions.appwrite.doma...