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

Instructions for Parameterized Configuration are not clear about deployment issues. #1505

Open
timothywise-lhs opened this issue Dec 22, 2023 · 1 comment

Comments

@timothywise-lhs
Copy link

[REQUIRED] Version info

node:
node v21.4.0

firebase-functions:
13.0.2

firebase-tools:

firebase-admin:

[REQUIRED] Test case

const apikey = defineSecret("APIKEY");
runWith({
  secrets: [apikey.name],
});
export const loadRemoteInfo = onRequest({secrets: [apikey]}, async (request, response) => {
  try {
    const responseFromRemote = await axios.get("https://remoteapi.com/api/v3/endpoint?key="+apikey.value());
    const data = responseFromRemote.data;
    response.status(200).send(data);
  } catch (error) {
    console.error("Error making https request: ", error);
    response.status(500).send();
  }
});

[REQUIRED] Steps to reproduce

Following the instructions at (https://firebase.google.com/docs/functions/config-env?gen=2nd#secret_parameters)
it gives instructions that one can use the secret in your typescript function, not really explaining the caveat about the secret not available at configuration and its implications.

[REQUIRED] Expected behavior

Follow the instructions correctly, and it works.

[REQUIRED] Actual behavior

First, the instructions don't mention that one must enable the Secrets product in GCP for your project. Once that is done, the instructions also don't mention the page or a short command on how to set the secret firebase functions:secrets:set when deploying beyond the local emulator (which prompts for the secret).

Lastly, the storing secrets in via the instructions doesn't actually work and appears not supported because of the error:
Error: Failed to load function definition from source: Failed to generate manifest from function source: Error: Cannot access the value of secret "APIKEY" during function deployment. Secret values are only available at runtime.

So, if they're only available at runtime, how does one deploy a function at depends on them? Is there an option that is required when running npm run deploy that should be in the linked document on using secret parameters? If so, it should be readily apparent in link above on how to use secret parameters. If not, the section on secret parameters should be omitted as functions that rely on them are non-deployable?

Were you able to successfully deploy your functions?

no

@google-oss-bot
Copy link
Collaborator

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants