如何为firebase在云函数中添加版本

时间:2022-12-07 22:08:12

Hi I have created one cloud function getUsers. Its can be accessed like https://xyz.cloudfunctions.net/getUsers

你好,我创建了一个云函数getUsers。它可以像https://xyz.cloudfunctions.net/getUsers一样访问

exports.getUsers = functions.https.onRequest((request, response) => {

});

I need to do some changes in the function and want to keep same function name. I want to add version in the cloud function so that it can be accessed like this

我需要对函数做一些修改,并保持相同的函数名。我想在云函数中添加version,以便像这样访问它

https://xyz.cloudfunctions.net/getUsers/v2

https://xyz.cloudfunctions.net/getUsers/v2

What is the way to do this in cloud function for Firebase ?

在Firebase的云函数中,如何做到这一点呢?

1 个解决方案

#1


3  

There is no built-in versioning for Cloud Functions. The closest you can get on the default URLs is writing the version into the function name: getUsers_v2.

云函数没有内置的版本控制。最接近默认url的是将版本写入函数名:getUsers_v2。

If you're using Firebase Hosting to give friendly URLs to your Cloud Functions, you can of course map each individual function to the URL you want.

如果您正在使用Firebase托管为云函数提供友好的URL,那么当然可以将每个单独的函数映射到您想要的URL。

#1


3  

There is no built-in versioning for Cloud Functions. The closest you can get on the default URLs is writing the version into the function name: getUsers_v2.

云函数没有内置的版本控制。最接近默认url的是将版本写入函数名:getUsers_v2。

If you're using Firebase Hosting to give friendly URLs to your Cloud Functions, you can of course map each individual function to the URL you want.

如果您正在使用Firebase托管为云函数提供友好的URL,那么当然可以将每个单独的函数映射到您想要的URL。