Created
January 5, 2023 19:34
-
-
Save omar-dulaimi/e0108e76fa354f85f835fa553738705a to your computer and use it in GitHub Desktop.
Generate download URL for a Firebase function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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