-
Notifications
You must be signed in to change notification settings - Fork 269
Description
What happened?
Following the documentation of including a dotenv file leads to an error in devbox.
Documentation in question: https://www.jetify.com/docs/devbox/guides/secrets/#setting-environment-variables-with-env-files
Steps to reproduce
devbox init
echo "SECRET=123456" > .envrc.private
- add the below to devbox.json
"env_from": [
".envrc.private"
]
devbox shell
- You should see the error "Error: Error loading devbox.json.
source: json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string"
Command
shell
devbox.json
Devbox version
0.13.5
Nix version
nix (Nix) 2.24.6
What system does this bug occur on?
macOS (Apple Silicon)
Debug logs
time=2024-10-28T14:36:34.100+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-28T14:36:34.100+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-28T14:36:34.100+11:00 level=ERROR source=go.jetpack.io/devbox/internal/devconfig/config.go:135 msg="config file search error" err="json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string" dur=297.125µs
time=2024-10-28T14:36:34.100+11:00 level=ERROR source=go.jetpack.io/devbox/internal/boxcli/run.go:79 msg="failed to open devbox" err="json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string\nError loading devbox.json.\ngo.jetpack.io/devbox/internal/boxcli/usererr.(*combined).Format\n\tgo.jetpack.io/devbox/internal/boxcli/usererr/usererr.go:135\nfmt.(*pp).handleMethods\n\tfmt/print.go:640\nfmt.(*pp).printArg\n\tfmt/print.go:756\nfmt.(*pp).doPrintf\n\tfmt/print.go:1074\nfmt.Sprintf\n\tfmt/print.go:239\nlog/slog.appendTextValue\n\tlog/slog/text_handler.go:119\nlog/slog.(*handleState).appendValue\n\tlog/slog/handler.go:578\nlog/slog.(*handleState).appendAttr\n\tlog/slog/handler.go:516\nlog/slog.(*handleState).appendNonBuiltIns.func1\n\tlog/slog/handler.go:342\nlog/slog.Record.Attrs\n\tlog/slog/record.go:84\nlog/slog.(*handleState).appendNonBuiltIns\n\tlog/slog/handler.go:341\nlog/slog.(*commonHandler).handle\n\tlog/slog/handler.go:308\nlog/slog.(*TextHandler).Handle\n\tlog/slog/text_handler.go:95\nlog/slog.(*Logger).log\n\tlog/slog/logger.go:257\nlog/slog.Error\n\tlog/slog/logger.go:312\ngo.jetpack.io/devbox/internal/boxcli.listScripts\n\tgo.jetpack.io/devbox/internal/boxcli/run.go:79\ngo.jetpack.io/devbox/internal/boxcli.runCmd\n\tgo.jetpack.io/devbox/internal/boxcli/run.go:66\ngo.jetpack.io/devbox/internal/boxcli.globalCmd\n\tgo.jetpack.io/devbox/internal/boxcli/global.go:37\ngo.jetpack.io/devbox/internal/boxcli.RootCmd\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:66\ngo.jetpack.io/devbox/internal/boxcli.Execute\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:111\ngo.jetpack.io/devbox/internal/boxcli.Main\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:139\nmain.main\n\t./main.go:11\nruntime.main\n\truntime/proc.go:272\nruntime.goexit\n\truntime/asm_arm64.s:1223"
time=2024-10-28T14:36:34.100+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-28T14:36:34.100+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-28T14:36:34.100+11:00 level=ERROR source=go.jetpack.io/devbox/internal/devconfig/config.go:135 msg="config file search error" err="json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string" dur=83.459µs
time=2024-10-28T14:36:34.100+11:00 level=ERROR source=go.jetpack.io/devbox/internal/boxcli/run.go:79 msg="failed to open devbox" err="json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string\nError loading devbox.json.\ngo.jetpack.io/devbox/internal/boxcli/usererr.(*combined).Format\n\tgo.jetpack.io/devbox/internal/boxcli/usererr/usererr.go:135\nfmt.(*pp).handleMethods\n\tfmt/print.go:640\nfmt.(*pp).printArg\n\tfmt/print.go:756\nfmt.(*pp).doPrintf\n\tfmt/print.go:1074\nfmt.Sprintf\n\tfmt/print.go:239\nlog/slog.appendTextValue\n\tlog/slog/text_handler.go:119\nlog/slog.(*handleState).appendValue\n\tlog/slog/handler.go:578\nlog/slog.(*handleState).appendAttr\n\tlog/slog/handler.go:516\nlog/slog.(*handleState).appendNonBuiltIns.func1\n\tlog/slog/handler.go:342\nlog/slog.Record.Attrs\n\tlog/slog/record.go:84\nlog/slog.(*handleState).appendNonBuiltIns\n\tlog/slog/handler.go:341\nlog/slog.(*commonHandler).handle\n\tlog/slog/handler.go:308\nlog/slog.(*TextHandler).Handle\n\tlog/slog/text_handler.go:95\nlog/slog.(*Logger).log\n\tlog/slog/logger.go:257\nlog/slog.Error\n\tlog/slog/logger.go:312\ngo.jetpack.io/devbox/internal/boxcli.listScripts\n\tgo.jetpack.io/devbox/internal/boxcli/run.go:79\ngo.jetpack.io/devbox/internal/boxcli.runCmd\n\tgo.jetpack.io/devbox/internal/boxcli/run.go:66\ngo.jetpack.io/devbox/internal/boxcli.RootCmd\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:75\ngo.jetpack.io/devbox/internal/boxcli.Execute\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:111\ngo.jetpack.io/devbox/internal/boxcli.Main\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:139\nmain.main\n\t./main.go:11\nruntime.main\n\truntime/proc.go:272\nruntime.goexit\n\truntime/asm_arm64.s:1223"
time=2024-10-28T14:36:34.171+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/nix.go:342 msg="nix --version --debug output" out="nix (Nix) 2.24.6\nSystem type: aarch64-darwin\nAdditional system types: x86_64-darwin\nFeatures: gc, signed-caches\nSystem configuration file: /etc/nix/nix.conf\nUser configuration files: /Users/tom.monaghan/.config/nix/nix.conf:/etc/xdg/nix/nix.conf\nStore directory: /nix/store\nState directory: /nix/var/nix\nData directory: /nix/store/d88r5b1qv1fvz2j9qndz8sr31mqgz45x-nix-2.24.6/share\n"
time=2024-10-28T14:36:34.171+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:60 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/nix/var/nix/profiles/default/bin/nix
time=2024-10-28T14:36:34.221+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:67 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/nix/var/nix/profiles/default/bin/nix cmd.pid=30321 cmd.code=0 cmd.dur=50.128709ms
time=2024-10-28T14:36:34.221+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-28T14:36:34.221+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-28T14:36:34.222+11:00 level=ERROR source=go.jetpack.io/devbox/internal/devconfig/config.go:135 msg="config file search error" err="json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string" dur=101.125µs
Error: Error loading devbox.json.
source: json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string
time=2024-10-28T14:36:34.222+11:00 level=ERROR source=go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:70 msg="command error" execid=f3e89dd1b6504ec8a580840832c351a5 stack="json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string\nError loading devbox.json.\ngo.jetpack.io/devbox/internal/boxcli/usererr.(*combined).Format\n\tgo.jetpack.io/devbox/internal/boxcli/usererr/usererr.go:135\nfmt.(*pp).handleMethods\n\tfmt/print.go:640\nfmt.(*pp).printArg\n\tfmt/print.go:756\nfmt.(*pp).doPrintf\n\tfmt/print.go:1074\nfmt.Fprintf\n\tfmt/print.go:224\ngithub.com/pkg/errors.(*withStack).Format\n\tgithub.com/pkg/errors@v0.9.1/errors.go:169\nfmt.(*pp).handleMethods\n\tfmt/print.go:640\nfmt.(*pp).printArg\n\tfmt/print.go:756\nfmt.(*pp).doPrintf\n\tfmt/print.go:1074\nfmt.Sprintf\n\tfmt/print.go:239\nlog/slog.appendTextValue\n\tlog/slog/text_handler.go:119\nlog/slog.(*handleState).appendValue\n\tlog/slog/handler.go:578\nlog/slog.(*handleState).appendAttr\n\tlog/slog/handler.go:516\nlog/slog.(*handleState).appendNonBuiltIns.func1\n\tlog/slog/handler.go:342\nlog/slog.Record.Attrs\n\tlog/slog/record.go:84\nlog/slog.(*handleState).appendNonBuiltIns\n\tlog/slog/handler.go:341\nlog/slog.(*commonHandler).handle\n\tlog/slog/handler.go:308\nlog/slog.(*TextHandler).Handle\n\tlog/slog/text_handler.go:95\nlog/slog.(*Logger).log\n\tlog/slog/logger.go:257\nlog/slog.Error\n\tlog/slog/logger.go:312\ngo.jetpack.io/devbox/internal/boxcli/midcobra.(*DebugMiddleware).postRun\n\tgo.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:70\ngo.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute\n\tgo.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:68\ngo.jetpack.io/devbox/internal/boxcli.Execute\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:116\ngo.jetpack.io/devbox/internal/boxcli.Main\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:139\nmain.main\n\t./main.go:11\nruntime.main\n\truntime/proc.go:272\nruntime.goexit\n\truntime/asm_arm64.s:1223\ngo.jetpack.io/devbox/internal/boxcli.runShellCmd\n\tgo.jetpack.io/devbox/internal/boxcli/shell.go:75\ngo.jetpack.io/devbox/internal/boxcli.shellCmd.func1\n\tgo.jetpack.io/devbox/internal/boxcli/shell.go:43\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.0/command.go:983\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.0/command.go:1039\ngo.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute\n\tgo.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:61\ngo.jetpack.io/devbox/internal/boxcli.Execute\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:116\ngo.jetpack.io/devbox/internal/boxcli.Main\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:139\nmain.main\n\t./main.go:11\nruntime.main\n\truntime/proc.go:272\nruntime.goexit\n\truntime/asm_arm64.s:1223"
time=2024-10-28T14:36:34.222+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-28T14:36:34.222+11:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-28T14:36:34.222+11:00 level=ERROR source=go.jetpack.io/devbox/internal/devconfig/config.go:135 msg="config file search error" err="json: cannot unmarshal array into Go struct field ConfigFile.env_from of type string" dur=50.542µs