Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dario-piotrowicz/next-on-pages-local-process.env-issue-repro
https://github.com/dario-piotrowicz/next-on-pages-local-process.env-issue-repro
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dario-piotrowicz/next-on-pages-local-process.env-issue-repro
- Owner: dario-piotrowicz
- Created: 2024-03-05T17:35:19.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-05T17:51:34.000Z (9 months ago)
- Last Synced: 2024-04-18T06:19:59.217Z (7 months ago)
- Language: CSS
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Next-on-pages local `process.env` issue repro
This is a minimal reproduction showing that `process.env` is not working as expected in the `@cloudflare/next-on-pages/next-dev` module.
`getRequestContext` is indeed working as intended and all bindings accessible via `getRequestContext` should also be accessible via `process.env`, but that doesn't seem to be the case.
> [!NOTE]
> This is a issue related to local development, `process.env` does work as expected in production## Steps to reproduce the issue
- ```sh
npm i
```- ```sh
npm run dev
```- with a browser navigate to `/api/hello`
- notice that the response is `Hello World from a KV store!`
- in `app/api/hello/route.ts` comment out `const from: string = 'reqCtx';` and uncomment `// const from: string = "process.env";`
- refresh the browser and notice that now `/api/hello` returns an error saying that it can't access `put` of `undefined`