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

inline global secrets don't seem to work #1339

Closed
mistermoe opened this issue Apr 26, 2024 · 0 comments · Fixed by #1340
Closed

inline global secrets don't seem to work #1339

mistermoe opened this issue Apr 26, 2024 · 0 comments · Fixed by #1340
Assignees

Comments

@mistermoe
Copy link
Collaborator

mistermoe commented Apr 26, 2024

FTL Version: 0.185.4

Repro

  1. Set the following secrets
echo -n abcd | ftl secret set keychain --keychain
❯ echo -n abcd | ftl secret set inline --inline
  1. Get them as a sanity check
❯ ftl secret get keychain
"abcd"
❯ ftl secret get inline
"abcd"
  1. Check resulting ftl-project.toml

Note

yours may have more. i reproduced this in a brand new project

ftl-min-version = ""

[global]
  [global.secrets]
    inline = "inline://ImFiY2Qi"
    keychain = "keychain://keychain"

[executables]
  ftl = ""

[commands]
  1. chuck the following into an ftl module:
package debug

import (
	"context"

	"github.com/TBD54566975/ftl/go-runtime/ftl"
)

var inlineSecHandle = ftl.Secret[string]("inline")
var keychainSecHandle = ftl.Secret[string]("keychain")

type RivetingRequest struct{}
type RivetingResponse struct{}

//ftl:export
func Rivet(ctx context.Context, req RivetingRequest) (RivetingResponse, error) {
	log := ftl.LoggerFromContext(ctx)
	inlineSec := inlineSecHandle.Get(ctx)
	keychainSec := keychainSecHandle.Get(ctx)

	log.Infof("inline secret: %s", inlineSec)
	log.Infof("keychain secret: %s", keychainSec)

	return RivetingResponse{}, nil
}
  1. pop open ftl console and send a request to verb

Output:

❯ ftl dev modules/debug --recreate
info: Starting FTL with 1 controller(s)
info:debug: Building module
info:debug: Deploying module
info:controller0: Deployed dpl-debug-cfk4q5bt7h77l7g
info: All modules deployed, watching for changes...
error:debug: panic in verb debug.rivet: failed to get secret "debug.inline": key "inline" not found

Important

the same will happen with keychain secret if you comment out inline secret references

error:debug: panic in verb debug.rivet: failed to get secret "debug.keychain": key "keychain" not found

hmm actually now that i'm trying even with the module specifier, it doesn't seem to work:

❯ ftl secret set debug.inline --inline
Secret:

❯ ftl secret get debug.inline
"abcd"

still getting:

error:debug: panic in verb debug.rivet: failed to get secret "debug.inline": key "inline" not found
@github-actions github-actions bot added the triage Issue needs triaging label Apr 26, 2024
@matt2e matt2e self-assigned this Apr 26, 2024
@github-actions github-actions bot removed the triage Issue needs triaging label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants