<:appwritefire:823999000330895380>
how do i import data coming from function execution?
What do you mean by import?
the data you pass through when executing a function. how do i access them in my function?
Like so
data = response.json()
You can see a good example here
yeah yeah yeaaaaaaah
so in python context.req.body ill access the body attached to the function execution?
Yes
functionId: '[FUNCTION_ID]',
body: json.encode({ 'foo': 'bar' }),
async: false,
path: '/',
method: 'GET',
headers: {
'X-Custom-Header': '123'
}
);```
what is async importance in the function execution?
and method?
Methodis relevant only when you want to check it inside the function.xasyncis if you want to execute the function in the background and fetch the results later using the getExecution function. this is probably what you don't want to do so just ignore it or set it as false.
what about getting the data that client side sent inside the function, using dart?
With dart? it's inside the req.body
import 'dart:convert';
final body = json.encode(context.req.body)
Check here
okay
<a:agooglethumbsup:635256484682530825>
you just saved my time
hello @Binyamin ive deployed a python function and im get below logs
File "/usr/local/server/src/server.py", line 165, in handler
output = await asyncio.wait_for(execute(context), timeout=safeTimeout)
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
return fut.result()
File "/usr/local/server/src/server.py", line 150, in execute
userModule = importlib.import_module("function." + userPath)
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'function.main'```
Have you used the appwrite cli or a python function starter to create your function?
As their is a specific structure for the function
i figured out the issue. i was creating a tar.gz of a folder instead of files
if i have function domain like this https://64d4d22db370ae41a32e.appwrite.global/
how do i pass data when im triggering it with url
please create your own <#1072905050399191082> for distinct problems instead of using someone else's
Recommended threads
- ClientException with SocketException: Cl...
hi <@564158268319203348> i have noticed this 500 status code in my function requests, it seems its not able to connect to the internet in the function as reque...
- NEW ERROR Invalid document structure: At...
Error: ```AppwriteException: document_invalid_structure, Invalid document structure: Attribute "pb.kmsgxPkgInfo.id_info" must be an array (400)``` I’m encounter...
- Issues with executor in Appwrite 1.9.0
Hi, I’ve recently did a fresh install of appwrite 1.9.0 self hosted and when I run a function, it just waits indefinite This is the error from the log: [Er...