Local appwrite run functions --user-id not generating x-appwrite-user-jwt (self-hosted)
- 0
- Self Hosted
- Functions
Hi, I'm running into an issue when testing Appwrite functions locally with user impersonation.
I'm using a self-hosted Appwrite instance and running functions locally with the CLI: appwrite run functions --function-id <FUNCTION_ID> --user-id <USER_ID>
The function runs correctly, but the impersonation headers are not generated.
Inside the function I logged the headers and I'm getting: log(JSON.stringify({ userId: req.headers['x-appwrite-user-id'] ?? null, hasUserJwt: Boolean(req.headers['x-appwrite-user-jwt']), hasApiKey: Boolean(req.headers['x-appwrite-key']), }, null, 2)); So: { "userId": "6978b6b8003822478082", "hasUserJwt": false, "hasApiKey": false }
The CLI prints the following warning: Dynamic API key not generated. Header x-appwrite-key will not be set. Reason: <email> (role: users) missing scopes (["users.read"])
However the function does have the required scopes in appwrite.config.json, including: "scopes": [ "users.read" ]
Other CLI commands work normally: appwrite push functions appwrite pull deployments etc.
So the CLI login seems valid.
Am I missing something in my setup, or is there any additional configuration required for local user impersonation on self-hosted Appwrite?
Recommended threads
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- Appwrite 1.9.0 doctor fails tho database...
So i was testing in a local environment the upgrade for 1.9.0, and after getting everything into a running state, i checked the logs that shows : ``` └── Cre...
- Failed to start containers.
I'm trying to install Appwrite locally but struck on the subject point. There is no clear error in logs.