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
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- Magic Link token automatically consumed
Hi, I'm using the Magic Link auth system with Appwrite Cloud and I'm running into huge issues getting users to log in successfully. About 9 times out of 10, th...
- Appwrite cloud DB server error 500
Getting this error