I’m getting the following error from my Workers API:
"exceptions": [
{
"name": "ReferenceError",
"message": "API_KEY is not defined",
"timestamp": 1673733383244
}
],
Why is that? I’ve already set the value via the Cloudflare Workers settings:
- Go back to the your worker’s dashboard by clicking on ‘Save & Deploy’ and then exit out of the editor.
- Under the Settings panel, click on Variables. Here you can set the environment variable for the worker.
- Click on ‘Add variable’ and input the variable name as API_KEY and the value as the bot’s API token and “save settings & deploy”.
And I’ve tried it several times, but still, I’m getting the above “API_KEY is not defined” error. Why & how to fix the problem?