Skip to content

Commit 6757a45

Browse files
committed
upgrade a single function at a time
1 parent 90899a8 commit 6757a45

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

.guides/upgrade.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
This guide provides a step-by-step process for migrating a single Cloud Function from 1st to 2nd generation. Migrate functions incrementally, running both generations side-by-side.
44

5-
## 1. Identify a v1 function to upgrade
5+
## 1. Identify a 1st-gen function to upgrade
66

7-
Let's say you have a 1st gen HTTP function like this:
7+
Find all 1st-gen functions in the directory. 1st-gen functions used a namespaced API like this:
88

99
**Before (1st Gen):**
1010
```typescript
@@ -15,7 +15,9 @@ export const webhook = functions.https.onRequest((request, response) => {
1515
});
1616
```
1717

18-
Now, let's upgrade it to 2nd gen.
18+
Sometimes, they'll explicitly import from the `firebase-functions/v1` subpackage, but not always.
19+
20+
Ask the user to pick a **single** function to upgrade from the list of 1st gen functions you found.
1921

2022
## 2. Update Dependencies
2123

@@ -148,10 +150,12 @@ export const func = onRequest(
148150

149151
## 7. Traffic Migration
150152

151-
To migrate traffic safely:
152-
1. Rename your new 2nd gen function with a different name.
153-
2. Comment out any existing `minInstances` or `maxInstances` config and instead set `maxInstances` to `1` while testing.
154-
3. Deploy it alongside the old 1st gen function.
155-
4. Gradually introduce traffic to the new function (e.g., via client-side changes or by calling it from the 1st gen function).
156-
5. Add back the original `minInstances` and `maxInstances` settings to the 2nd gen function.
157-
6. Once you are confident, you can delete the 1st gen function.
153+
Tell the user these steps to migrate safely:
154+
155+
> To migrate traffic safely:
156+
> 1. Rename your new 2nd gen function with a different name.
157+
> 2. Comment out any existing `minInstances` or `maxInstances` config and instead set `maxInstances` to `1` while testing.
158+
> 3. Deploy it alongside the old 1st gen function.
159+
> 4. Gradually introduce traffic to the new function (e.g., via client-side changes or by calling it from the 1st gen function).
160+
> 5. Add back the original `minInstances` and `maxInstances` settings to the 2nd gen function.
161+
> 6. Once you are confident, you can delete the 1st gen function.

0 commit comments

Comments
 (0)