Skip to content

Instantly share code, notes, and snippets.

@omar-dulaimi
Created January 5, 2023 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omar-dulaimi/e0108e76fa354f85f835fa553738705a to your computer and use it in GitHub Desktop.
Save omar-dulaimi/e0108e76fa354f85f835fa553738705a to your computer and use it in GitHub Desktop.
Generate download URL for a Firebase function
const { google } = require("googleapis");
const cloudfunctions = google.cloudfunctions("v1");
async function main() {
const auth = new google.auth.GoogleAuth({
scopes: ["https://www.googleapis.com/auth/cloud-platform"],
});
const authClient = await auth.getClient();
google.options({ auth: authClient });
const result =
await cloudfunctions.projects.locations.functions.generateDownloadUrl({
// The name of function for which source code Google Cloud Storage signed URL should be generated.
name: "projects/my-project/locations/my-location/functions/my-function",
requestBody: {
// request body parameters
// {
// "versionId": "my_versionId"
// }
},
});
console.log(result.data.downloadUrl);
}
main().catch((e) => {
console.error(e);
throw e;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment