Skip to content

Unable to deploy functions using runtime service acct env vars #1392

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

Closed
amsipe opened this issue May 12, 2023 · 3 comments
Closed

Unable to deploy functions using runtime service acct env vars #1392

amsipe opened this issue May 12, 2023 · 3 comments
Assignees

Comments

@amsipe
Copy link

amsipe commented May 12, 2023

Related issues

custom params

[REQUIRED] Version info

node: v16.14.0

firebase-functions: v4.4.0

firebase-tools: 11.30.0

firebase-admin: 11.5.0

[REQUIRED] Test case

Create a .env.<projectId> file.

Example function:

const { defineString } = require('firebase-functions/params');
const paramSA = defineString('RUNTIME_SA');

const RUNTIME_OPTS = {
  serviceAccount: paramSA,
}
exports.helloWorld = functions.runWith(RUNTIME_OPTS).https.onCall(async (data, context) => {
    return true;
});

[REQUIRED] Steps to reproduce

run firebase deploy --debug --only functions:helloWorld --project <projectId>

[REQUIRED] Expected behavior

Deploy success with serviceAccount linked in config.

[REQUIRED] Actual behavior

"message": "HTTP Error: 400, Invalid function service account requested: {{ params.RUNTIME_SA }}.

Were you able to successfully deploy your functions?

Redacted logs but still show issue:
{
"endpoint": {
"id": "...",
"project": "...",
"region": "us-central1",
"entryPoint": "",
"platform": "gcfv1",
"runtime": "nodejs16",
"callableTrigger": {},
"labels": {
"deployment-tool": "cli-firebase"
},
"serviceAccount": "{{ params.RUNTIME_SA }}",
"ingressSettings": null,
"availableMemoryMb": 128,
"timeoutSeconds": 20,
"maxInstances": null,
"minInstances": null,
"vpc": null,
"environmentVariables": {
"RUNTIME_SA": "[email protected]",
"FIREBASE_CONFIG": "...",
"GCLOUD_PROJECT": "...",
"EVENTARC_CLOUD_EVENT_SOURCE": "..."
},
"codebase": "default",
"securityLevel": "SECURE_OPTIONAL",
"targetedByOnly": true,
"hash": "..."
},
"op": "update",
"original": {
"name": "FirebaseError",
"children": [],
"context": {
"function": "projects//"
},
"exit": 1,
"message": "Failed to update function projects//",
"original": {
"name": "FirebaseError",
"children": [],
"context": {
"body": {
"error": {
"code": 400,
"message": "Invalid function service account requested: {{ params.RUNTIME_SA }}. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.",
"status": "INVALID_ARGUMENT"
}
},
"response": {
"statusCode": 400
}
},
"exit": 1,
"message": "HTTP Error: 400, Invalid function service account requested: {{ params.RUNTIME_SA }}. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.",
"status": 400
},
"status": 400
}
}

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@amsipe
Copy link
Author

amsipe commented May 12, 2023

Forgot to mention that if hard-code the service acct as a string in the RUNTIME_OPTS we are able to deploy. But thats how we had it configured before this release
https://github.com/firebase/firebase-functions/releases/tag/v4.3.0

@taeold
Copy link
Contributor

taeold commented May 15, 2023

Hi @amsipe - you can't use params to set service accounts... YET!

I'm going to push to get that feature out this week. Please follow along at firebase/firebase-tools#5224.

Thank you!

@taeold taeold closed this as completed May 15, 2023
@taeold taeold self-assigned this May 15, 2023
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