[Bug]: At runtime the App is unable to find `./.env.prod` and other similarly named files.
What happened?
>>> unzip -l deployment.tar
Archive: deployment.tar
Length Date Time Name
--------- ---------- ----- ----
32 2024-12-19 15:47 .env.example
83 2024-12-19 15:47 .env.local
83 2024-12-19 15:47 .env.prerelease
83 2024-12-19 15:47 .env.prod
83 2024-12-19 15:47 .env.savegist
70 2024-12-19 15:47 .gitignore
835 2024-12-19 15:47 .pre-commit-config.yaml
713 2024-12-19 15:47 .pre-commit-hooks.yaml
76 2024-12-19 15:47 .vscode/settings.json
80406 2024-12-19 15:47 Cargo.lock
747 2024-12-19 15:47 Cargo.toml
529 2024-12-19 15:47 Dockerfile-prod
5095 2024-12-19 15:47 Makefile
4860 2024-12-19 15:47 README.md
136 2024-12-19 15:47 Shuttle.toml
33999 2024-12-19 15:47 deployment.tar
246 2024-12-19 15:47 docker-compose-prod.yaml
28 2024-12-19 15:47 rust-toolchain.toml
5400 2024-12-19 15:47 shuttle-examples/jsonwebtoken-axum.rs
9587 2024-12-19 15:47 src/lib.rs
2468 2024-12-19 15:47 src/main.rs
6608 2024-12-19 15:47 tests/auth_tests.rs
--------- -------
152167 22 files
As seen in above output, these files:
32 2024-12-19 15:47 .env.example
83 2024-12-19 15:47 .env.local
83 2024-12-19 15:47 .env.prerelease
83 2024-12-19 15:47 .env.prod
83 2024-12-19 15:47 .env.savegist
are located at the root directory but at runtime, the App is unable to find them.
Version
v0.49.0
Which operating system(s) are you seeing the problem on?
Linux
Which CPU architectures are you seeing the problem on?
No response
Relevant log output
No response
Duplicate declaration
- [X] I have searched the issues and there are none like this.
Try declaring them as build assets https://docs.shuttle.dev/docs/files#build-assets
I am having a similar issue. I am using a .env file for secrets, because the client builds with some of them and shares them with the server, and I have:
[deploy]
include = ["dist/*", ".env"]
[build]
assets = ["dist/*", ".env"]
But, running shuttle deploy --secrets .env --output-archive deployment.zip shows no .env with:
tar -tf .\deployment.zip
_Also, the deployment fails with:
2025-06-10T18:00:57.971+02:00 [builder] #23 0.180 find: '.env': No such file or directory
2025-06-10T18:00:57.971+02:00 [builder] #23 ERROR: process "/bin/sh -c for path in $(tq -r '.build.assets // .build_assets // [] | join(\" \")' Shuttle.toml); do find \"$path\" -type f -exec echo Copying \\{\\} \\; -exec install -D \\{\\} /build_assets/\\{\\} \\; ; done" did not complete successfully: exit code: 1
2025-06-10T18:00:57.971+02:00 [builder] ------
2025-06-10T18:00:57.971+02:00 [builder] > importing cache manifest from 905418083045.dkr.ecr.eu-west-2.amazonaws.com/proj_01jxd8yq0gycv8yb5czyyf0mv5:buildcache:
2025-06-10T18:00:57.971+02:00 [builder] ------
2025-06-10T18:00:57.971+02:00 [builder] ------
2025-06-10T18:00:57.971+02:00 [builder] > [builder 9/9] RUN for path in $(tq -r '.build.assets // .build_assets // [] | join(" ")' Shuttle.toml); do find "$path" -type f -exec echo Copying {} ; -exec install -D {} /build_assets/{} ; ; done:
2025-06-10T18:00:57.971+02:00 [builder] 0.165 Copying dist/assets/__vite-browser-external-BjuWrveP.js
2025-06-10T18:00:57.971+02:00 [builder] 0.166 Copying dist/assets/index-CbZh95YU.css
2025-06-10T18:00:57.971+02:00 [builder] 0.168 Copying dist/assets/index-DaC6WzLC.js
2025-06-10T18:00:57.971+02:00 [builder] 0.170 Copying dist/index.html
2025-06-10T18:00:57.971+02:00 [builder] 0.172 Copying dist/mocks/exams.json
2025-06-10T18:00:57.971+02:00 [builder] 0.174 Copying dist/prism.css
2025-06-10T18:00:57.971+02:00 [builder] 0.176 Copying dist/prism.js
2025-06-10T18:00:57.971+02:00 [builder] 0.178 Copying dist/vite.svg
2025-06-10T18:00:57.971+02:00 [builder] 0.180 find: '.env': No such file or directory
2025-06-10T18:00:57.971+02:00 [builder] ------
2025-06-10T18:00:57.971+02:00 [builder] Dockerfile:38
2025-06-10T18:00:57.971+02:00 [builder] --------------------
2025-06-10T18:00:57.971+02:00 [builder] 36 |
2025-06-10T18:00:57.971+02:00 [builder] 37 |
2025-06-10T18:00:57.971+02:00 [builder] 38 | >>> RUN for path in $(tq -r '.build.assets // .build_assets // [] | join(" ")' Shuttle.toml); do find "$path" -type f -exec echo Copying \{\} \; -exec install -D \{\} /build_assets/\{\} \; ; done
2025-06-10T18:00:57.971+02:00 [builder] 39 |
2025-06-10T18:00:57.971+02:00 [builder] 40 |
2025-06-10T18:00:57.971+02:00 [builder] --------------------
@ShaunSHamilton The --secrets arg internally renames the specified file to Secrets.toml when creating the zip file, as it is meant for non-default Secrets.toml locations. To use .env, it should be enough with the config you have and then a deployment without --secrets.
The behavior of --secrets is actually a remnant of past behavior on the old platform, so this reminds me that we can use it in a better way now...
Closing due to #2070