I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls Health(). I can execute appwrite run function, spin up the docker container, and get everything built.
The problem is that at the start before environment preparation, I get a warning: Warning: Dynamic API key not generated. Header x-appwrite-key will not be set. Reason: Not Found
I am wondering if this is leading to a secondary error, as when I attempt to open the resulting localhost:3000 website, I get the following error: User (role: guests) missing scopes (["health.read"])
In my appwrite.config.json file I have "guests" added to the execute, and all health.read added to scopes.
I am able to push the function, deploy, activate, and execute in my Console. I can also see, following the push, that the Guests is in the Role list, and the health.read is a selected scope.
If it matters, I also get this warning right after the success and url printout: /usr/local/server/src/function/runtime-env/lib/python3.14/site-packages/aiohttp/web_protocol.py:627: SyntaxWarning: 'break' in a 'finally' block break
Printing the x-appwrite-key gets an empty string.
My appwrite version is 19.0.0
My code is below:
from appwrite.client import Client
from appwrite.services.health import Health
import os
def main(context):
try:
client = (
Client()
.set_endpoint(os.environ["APPWRITE_FUNCTION_API_ENDPOINT"])
.set_project(os.environ["APPWRITE_FUNCTION_PROJECT_ID"])
.set_key(context.req.headers.get("x-appwrite-key"))
)
Health(client).get()
return context.res.json({"status": "ok"})
except Exception as e:
context.error(str(e))
return context.res.json({"status": "error", "message": "Internal server error"}, 500)
CLI output:
runtime │ entrypoint │ path │ commands │ scopes
─────────────┼─────────────┼──────────────────────────┼─────────────────────────────────┼────────────
python-3.14 │ src/main.py │ functions/so-healthcheck │ pip install -r requirements.txt │ [54 items]
♥ Hint: If you wish to change your local settings, update the appwrite.config.json file and rerun the 'appwrite run' command.
♥ Hint: Permissions, events, CRON and timeouts don't apply when running locally.
ℹ Warning: Dynamic API key not generated. Header x-appwrite-key will not be set. Reason: Not Found
ℹ Info: Verifying Docker image ...
ℹ Info: Building function using Docker ...
>> After env prep, package installations, and starting function in docker:
[00:56:36] [open-runtimes] Runtime started.
HTTP server successfully started!
✓ Success: Visit http://localhost:3000/ to execute your function.
/usr/local/server/src/function/runtime-env/lib/python3.14/site-packages/aiohttp/web_protocol.py:627: SyntaxWarning: 'break' in a 'finally' block
break
ℹ Info: Runtime logs: >> Here I open the localhost link
User (role: guests) missing scopes (["health.read"])
User (role: guests) missing scopes (["health.read"])
Recommended threads
- Regarding Rate Limits
Hello, I am a student engineer who built an internal website for my university club using AppWrite. My club currently has around 500 members, and when I recent...
- Error trying to deploy functions from CL...
✗ Error • on-auth-create (6a00b2ab000c9ce2949b) • Server Error ✗ Error: No functions were pushed. Prject ID: 69ffe0270033a4ac420a
- Intermittent Deploy and Execution Errors...
Project: project-fra-658e2f5f4ba30df91177 Function ID: 69bde006001c56757f49 **Several execution errors with:** Timed out waiting for runtime.\nError Code: 400...