cloudflare / cloudflare/serverless-cloudflare-workers

Environment Vars Not Working

Open
#43 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
180
Forks
34
PR merge metrics
No merged PRs in 30d

Description

I'm trying to get environment variables working as described in the documentation but not having any lucky.

serverless.yml

service:
name: library

provider:
name: cloudflare
stage: systest
config:
accountId:
zoneId:
environment:
MY_TEST: HELLO

plugins:
- serverless-cloudflare-workers

functions:
library:
name: library
script: handlers/test
environment:
MY_TEST: WORLD
events:
- http:
url: docs.somedomain.com/*
method: GET

test.js

```
addEventListener('fetch', event => {
event.respondWith(handle(event))
})

async function handle(event) {

console.log('MY_TEST: ', process.env.MY_TEST);

return new Response(null, { status: 200 });
}
```

I've tried `process.env.MY_TEST` and just plain old `MY_TEST` and no luck.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.