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
- Bulk feature status
Hi there, I am using version 1.7.4 self hosted and wanted to use the bulk operations in a dart function. I saw that in the dart_appwrite sdk version 16.1.0 it ...
- CORS preflight returns 500 on Dart funct...
Hey everyone 👋 I’m running a Dart cloud function, Every time I respond to a preflight (OPTIONS) request, I get a 500 internal error, and the logs show: ```NoSu...
- execution failed
When executing an appwrite function, I'm getting a 500 error, but I don't see it in executions. This issue appeared today. Here's the appwrite function ID: 68b4...