[SOLVED] An internal curl error has occurred within the executor! Error Msg: Could not resolve host:
- 1
- Self Hosted
- Functions
- Apple
One thing in the development docs that I've noticed -> https://appwrite.io/docs/products/functions/development#response Here in Swift language, "return context.res.send("<h1>This is an HTML response</h1>", 200, [ "content-type": "text/html" ])" This line when executed throws an error saying that "Missing parameters statusCode: and headers: "
I added statusCode: and headers: parameters in functions so it builds fine...But again does not execute.
Did that, and the first point of failure is me trying to get data from context.req.body Can you help with this? because the way mentioned in docs is throwing syntax errors while deploying.
What error exactly?
It cannot seem to find NSJSONSerialization. Which is true because it is renamed to just JSONSerialization
So this is a runtime error and it's because the input isn't a JSON serializable string
if I pass a json data like this one -> {"text": "Hello world from json", "from": "567898765678"}, then what should be the way for me to get that in my funtion?
When I straight up write context.log(context.req.body), it prints the above json as expected...but If I try to get individual value like context.req.body["text"]...It gives the error that context.req.body does not supports subscripts
How are you executing the function?
Via console, and passing the headers and body
What headers?
Authorization
but that is just for me see if i can get those data or not
headers I can get by just context.req.headers["KeyName"] and it works great
but not working with body
Body will be a string unless Appwrite knows the content is supposed to be JSON via the headers (content-type: application/json
)
Oh okay will add that too in headers
Also silly question, but the only way I can test if my function compiles is by deploying to Appwrite and then waiting for the results?
You can set up a local instance of Appwrite and deploy to that.
Technically, you can also run the build commands manually using open runtimes, but it's a little complicated.
We plan to make local development easier in the future
Sure. Thanks
A hacky quick way to compile locally is to copy the open runtime files into your package and add Vapor as dependency, then you can compile your function package with Xcode or xcodebuild
. When deploying just ignore or delete the runtime files.
The deployment fails when I try to bundle resources with my Swift Package....
So basically I added resource in my target and tried accessing them using Bundle.module...But the error is thrown saying "type 'Bundle' has no member 'module'"....Now one reasoning I came up with is that The Bundle.module property is available in Swift packages starting from Swift 5.3 (Although I'm working with 5.8). So, I tried to use Bundle(for: ) to get ref to bundle...But that does not seem to get the path to file either.
The resource is an html file here.
Did you list the html file in Package.swift?
Yes I did. Some other work came so this was on hold. So yeah, I listed it as well
Labelling this whole issue -> SOLVED as with the original problem I faced, @Steven helped me sort it out.
[SOLVED] An internal curl error has occurred within the executor! Error Msg: Could not resolve host:
Recommended threads
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...