-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SESSION_SECRET is not defined in fresh development setup #129
Comments
Could you try running |
Thanks for the immediate response! PS C:\Users\Patricia\git\jsonhero-web> npm run build
> build
> npm run build:css && npm run build:search && remix build
> build:css
> tailwindcss -i ./styles/tailwind.css -o ./app/tailwind.css --minify
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
warn - The `@variants` directive has been deprecated in Tailwind CSS v3.0.
warn - Use `@layer utilities` or `@layer components` instead.
warn - https://tailwindcss.com/docs/upgrade-guide#replace-variants-with-layer
Done in 1238ms.
> build:search
> esbuild ./app/entry.worker.ts --outfile=./public/entry.worker.js --bundle --format=esm --define:process.env.NODE_ENV='"production"'
public\entry.worker.js 649.1kb
Done in 55ms
Building Remix app in production mode...
Built in 1.5s PS C:\Users\Patricia\git\jsonhero-web> npm start
> start
> concurrently "npm run dev" "npm run start:worker"
[0]
[0] > dev
[0] > concurrently "npm run dev:css" "npm run dev:search" "remix watch"
[0]
[1]
[1] > start:worker
[1] > miniflare --env .env --build-command "npm run dev:worker" --watch
[1]
[1] (node:4160) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
[1] (Use `node --trace-warnings ...` to show where the warning was created)
[0] [2] Watching Remix app in development mode...
[0] [0]
[0] [0] > dev:css
[0] [0] > tailwindcss -i ./styles/tailwind.css -o ./app/tailwind.css --watch
[0] [0]
[0] [1]
[0] [1] > dev:search
[0] [1] > esbuild ./app/entry.worker.ts --outfile=./public/entry.worker.js --bundle --format=esm --define:process.env.NODE_ENV='"development"' --watch
[0] [1]
[1]
[1] > dev:worker
[1] > esbuild --define:process.env.NODE_ENV='"development"' --bundle --sourcemap --outdir=dist ./worker
[1]
[0] [1] [watch] build finished, watching for changes...
[1]
dist\worker.js 2.3mb
[1] dist\worker.js.map 3.4mb
[1]
[1] Done in 559ms
[1] [mf:inf] Build succeeded
[0] [2] 💿 Built in 2.5s
[0] [0] Browserslist: caniuse-lite is outdated. Please run:
[0] [0] npx browserslist@latest --update-db
[0] [0] Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
[0] [0]
[0] [0] warn - The `@variants` directive has been deprecated in Tailwind CSS v3.0.
[0] [0] warn - Use `@layer utilities` or `@layer components` instead.
[0] [0] warn - https://tailwindcss.com/docs/upgrade-guide#replace-variants-with-layer
[0] [0]
[0] [0] Rebuilding...
[1] [mf:err] C:\Users\Patricia\git\jsonhero-web\dist\worker.js:23923
[1] var Lwe = SESSION_SECRET;
[1] ^
[1]
[1] ReferenceError: SESSION_SECRET is not defined
[1] at C:\Users\Patricia\git\jsonhero-web\build\index.js:67:317
[1] at C:\Users\Patricia\git\jsonhero-web\dist\worker.js:52767:3
[1] at Script.runInContext (node:vm:139:12)
[1] at VMScriptRunner.runAsScript (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:25:12)
[1] at VMScriptRunner.run (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:84:12)
[1] at EventTarget.#reload (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:775:42)
[1] at EventTarget.getPlugins (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:1017:5)
[1] at createServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:369:19)
[1] at startServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:476:18)
[1] at main (C:\Users\Patricia\git\jsonhero-web\node_modules\miniflare\src\cli.ts:111:7)
[1] [mf:err] Unhandled Promise Rejection: C:\Users\Patricia\git\jsonhero-web\dist\worker.js:23923
[1] var Lwe = SESSION_SECRET;
[1] ^
[1]
[1] ReferenceError: SESSION_SECRET is not defined
[1] at C:\Users\Patricia\git\jsonhero-web\build\index.js:67:317
[1] at C:\Users\Patricia\git\jsonhero-web\dist\worker.js:52767:3
[1] at Script.runInContext (node:vm:139:12)
[1] at VMScriptRunner.runAsScript (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:25:12)
[1] at VMScriptRunner.run (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:84:12)
[1] at EventTarget.#reload (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:775:42)
[1] at EventTarget.getPlugins (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:1017:5)
[1] at createServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:369:19)
[1] at startServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:476:18)
[1] at main (C:\Users\Patricia\git\jsonhero-web\node_modules\miniflare\src\cli.ts:111:7)
[1] npm run start:worker exited with code 1
[0] [0] Done in 868ms.
[0] [2] 💿 File changed: app\tailwind.css
[0] [2] 💿 Rebuilding...
[0] [2] 💿 Rebuilt in 1s |
NB: SESSION_SECRET=54c75f2dad5520a2b7f5168fbdfa6a5c410827bb6cb9c33e8ff291a7bd0d3d88 |
Interesting... so |
Just the same :( PS C:\Users\Patricia\git\jsonhero-web> npm run start:worker
> start:worker
> miniflare --env .env --build-command "npm run dev:worker" --watch
(node:13352) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
> dev:worker
> esbuild --define:process.env.NODE_ENV='"development"' --bundle --sourcemap --outdir=dist ./worker
dist\worker.js 4.2mb
dist\worker.js.map 7.4mb
Done in 687ms
[mf:inf] Build succeeded
[mf:err] C:\Users\Patricia\git\jsonhero-web\dist\worker.js:54468
var sessionSecret = SESSION_SECRET;
^
ReferenceError: SESSION_SECRET is not defined
at C:\Users\Patricia\git\jsonhero-web\app\theme.server.ts:5:23
at C:\Users\Patricia\git\jsonhero-web\dist\worker.js:106223:3
at Script.runInContext (node:vm:139:12)
at VMScriptRunner.runAsScript (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:25:12)
at VMScriptRunner.run (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:84:12)
at EventTarget.#reload (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:775:42)
at EventTarget.getPlugins (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:1017:5)
at createServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:369:19)
at startServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:476:18)
at main (C:\Users\Patricia\git\jsonhero-web\node_modules\miniflare\src\cli.ts:111:7)
[mf:err] Unhandled Promise Rejection: C:\Users\Patricia\git\jsonhero-web\dist\worker.js:54468
var sessionSecret = SESSION_SECRET;
^
ReferenceError: SESSION_SECRET is not defined
at C:\Users\Patricia\git\jsonhero-web\app\theme.server.ts:5:23
at C:\Users\Patricia\git\jsonhero-web\dist\worker.js:106223:3
at Script.runInContext (node:vm:139:12)
at VMScriptRunner.runAsScript (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:25:12)
at VMScriptRunner.run (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\runner-vm\src\index.ts:84:12)
at EventTarget.#reload (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:775:42)
at EventTarget.getPlugins (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\core\src\index.ts:1017:5)
at createServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:369:19)
at startServer (C:\Users\Patricia\git\jsonhero-web\node_modules\@miniflare\http-server\src\index.ts:476:18)
at main (C:\Users\Patricia\git\jsonhero-web\node_modules\miniflare\src\cli.ts:111:7) |
Just curious, which version of node are you on? |
My current Node version is |
It does pick up the [1] [mf:inf] Build succeeded
[1] [mf:err] Error: ENOENT: no such file or directory, open 'C:\Users\Patricia\git\jsonhero-web\.env'
[1] Error: ENOENT: no such file or directory, open 'C:\Users\Patricia\git\jsonhero-web\.env'
[1] npm run start:worker exited with code 1 |
I wonder if miniflare isn't correctly passing the env vars through to the subcommand |
Hey @ericallam, 👋 |
Hello @ericallam 👋
I wanted to take a look at this and started playing with the project, but couldn't get it set up...
I didn't want to open an issue simply for this; but maybe you can just point me in the right direction without much trouble 🙇♀️
I basically simply followed the procedure indicated in DEVELOPMENT.md, created my
.env
file:I could run all the tests, perform
npm run dev
, it all works fine... untilnpm start
:Why isn't it picking up my
.env
file? What am I doing wrong?OS: Windows 10
The text was updated successfully, but these errors were encountered: