Skip to content
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

ftl [config|secret] set panics if module doesn't exist in ftl-project.toml #1174

Closed
mistermoe opened this issue Apr 4, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mistermoe
Copy link
Collaborator

Steps to Reproduce

  1. init an ftl project or choose a pre-existing one
  2. create a module or select a pre-existing one
  3. run ftl config set --inline <REPLACE_WITH_MODULE_NAME>.HILLBILLY JENKINS

you'll get

panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/TBD54566975/ftl/common/configuration.ProjectConfigResolver[...].Set(0x1040d0820?, {0x1040c09b8?, 0x14000364de0?}, {{{0x14000692288, 0x9?}, 0x1?}, {0x14000692292, 0x9}}, 0x14000597320)
  github.com/TBD54566975/ftl/common/configuration/projectconfig_resolver.go:83 +0x130
github.com/TBD54566975/ftl/common/configuration.(*Manager[...]).Set(0x7, {0x1040c09b8?, 0x14000364de0}, {{{0x14000692288, 0x9}, 0x1}, {0x14000692292, 0x9}}, {0x103e40440, 0x1400048b730})
  github.com/TBD54566975/ftl/common/configuration/manager.go:110 +0xf0
main.(*configSetCmd).Run(0x104c35450, {0x1040c09b8, 0x14000364de0}, 0x14000690248?, {0x12bb23818?, 0x104c9ed20?})
  github.com/TBD54566975/ftl/cmd/ftl/cmd_config.go:135 +0x204
reflect.Value.call({0x103e92b60?, 0x104c35450?, 0x1400011f848?}, {0x103af4b0c, 0x4}, {0x14000392a20, 0x3, 0x103654278?})
  reflect/value.go:596 +0x980
reflect.Value.Call({0x103e92b60?, 0x104c35450?, 0x1400011f948?}, {0x14000392a20?, 0x1040a0860?, 0x1400011f880?})
  reflect/value.go:380 +0x94
github.com/alecthomas/kong.callFunction({0x103e92b60?, 0x104c35450?, 0x1400011fad0?}, 0x14000364f60)
  github.com/alecthomas/[email protected]/callbacks.go:98 +0x390
github.com/alecthomas/kong.(*Context).RunNode(0x14000436080, 0x1400042be00, {0x1400011fef8, 0x1, 0x1040de330?})
  github.com/alecthomas/[email protected]/context.go:774 +0x630
github.com/alecthomas/kong.(*Context).Run(0x1400025e930?, {0x1400011fef8?, 0x14000364de0?, 0x103e0bbc0?})
  github.com/alecthomas/[email protected]/context.go:799 +0x138
main.main()
  github.com/TBD54566975/ftl/cmd/ftl/main.go:117 +0xac8
@mistermoe mistermoe added the bug Something isn't working label Apr 4, 2024
@github-actions github-actions bot added the triage Issue needs triaging label Apr 4, 2024
@alecthomas alecthomas mentioned this issue Apr 4, 2024
@wesbillman wesbillman added the good first issue Good for newcomers label Apr 5, 2024
@wesbillman
Copy link
Collaborator

I've noticed a few things as well...

If no ftl-project.toml file is found, most commands will panic instead of creating the file the first time. So on a new ftl project without an ftl-project.toml this will fail

ftl config set --inline name value
panic: assignment to entry in nil map

Because the above is setting a global configuration value, the command will also panic if the ftl-project.toml file is empty or doesn't contain BOTH of these. Maybe these should just get automatically created?

[global]
  [global.configuration]

It will also panic as @mistermoe describes above if a unknown module name is used.

@alecthomas alecthomas added next Work that will be be picked up next and removed triage Issue needs triaging labels Apr 8, 2024
@deniseli deniseli self-assigned this Apr 12, 2024
@github-actions github-actions bot removed the next Work that will be be picked up next label Apr 12, 2024
deniseli added a commit that referenced this issue Apr 16, 2024
…e config or secret (#1273)

Fixes issue #1174

Also tested manually by:
```
Open ftl-project.toml and confirm no module "echooo" is referenced
$ ftl config set --inline echooo.HILLBILLY JENKINS
Open ftl-project.toml and confirm this KV pair was added

$ rm ftl-project.toml
$ ftl config set --inline echooo.HILLBILLY JENKINS
Open ftl-project.toml and confirm this KV pair was added

Repeat for s/config/secret/
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants