Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Updating source code from cloud function

I have 200 functions that i have deployed and I need to update them programatically.  

Using this code in Node.JS

 

const updateFunctionArchive = async (f, fileName) => {
 
const client = new CloudFunctionsServiceClient({
keyFilename: "./insights-424213-105249cc546f.json",
});

f.sourceArchiveUrl = `gs://import-od-bigquery/` + fileName;

const [operation] = await client.updateFunction({
function: f,
});

console.log(`Operation Name: ${operation.name}`);
};
 
However I get this error in Google Cloud Function logs

status{
code3
message"Failed to retrieve function source code"
}
}

I verified the file is being uploaded, and the archive has all the node js files.
 
Is this the right approach?  If so, any suggestions on how to fix it?
 
Also, when I am deploying these functions what happens if they are down and a trigger is created from someone uploading?  I dont want to miss any uploads?
.
0 0 294
0 REPLIES 0