diff --git a/Firebase/functions/package-lock.json b/Firebase/functions/package-lock.json index 93e60a66..5f839b66 100644 --- a/Firebase/functions/package-lock.json +++ b/Firebase/functions/package-lock.json @@ -10,7 +10,7 @@ "axios": "^1.9.0", "dotenv": "^16.5.0", "firebase-admin": "^12.6.0", - "firebase-functions": "^7.0.5", + "firebase-functions": "^7.2.2", "jsonwebtoken": "^9.0.2" }, "devDependencies": { @@ -3145,9 +3145,9 @@ "license": "MIT" }, "node_modules/firebase-functions": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-7.0.5.tgz", - "integrity": "sha512-uG2dR5AObLuUrWWjj/de5XxNHCVi+Ehths0DSRcLjHJdgw1TSejwoZZ5na6gVrl3znNjRdBRy5Br5UlhaIU3Ww==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-7.2.2.tgz", + "integrity": "sha512-fWFVI+4weuaat+Fp+4xYY1T+omiTvya8fW79+edgLWCOaDEBSBNlfhstnt+K1esblscZlJf8v+IA0LsCG8Uf1Q==", "license": "MIT", "dependencies": { "@types/cors": "^2.8.5", diff --git a/Firebase/functions/package.json b/Firebase/functions/package.json index f6930575..f5fe7f8e 100644 --- a/Firebase/functions/package.json +++ b/Firebase/functions/package.json @@ -18,7 +18,7 @@ "axios": "^1.9.0", "dotenv": "^16.5.0", "firebase-admin": "^12.6.0", - "firebase-functions": "^7.0.5", + "firebase-functions": "^7.2.2", "jsonwebtoken": "^9.0.2" }, "devDependencies": { diff --git a/Firebase/functions/src/auth/apple.ts b/Firebase/functions/src/auth/apple.ts index 3e9dc953..132e05e5 100644 --- a/Firebase/functions/src/auth/apple.ts +++ b/Firebase/functions/src/auth/apple.ts @@ -54,7 +54,7 @@ function getAppleConfiguration() { export const requestAppleCustomToken = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: "asia-northeast3", }, async (request) => { try { @@ -142,7 +142,7 @@ export const requestAppleCustomToken = onCall({ export const requestAppleRefreshToken = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: "asia-northeast3", }, async (request) => { if (!request.auth) { @@ -186,7 +186,7 @@ export const requestAppleRefreshToken = onCall({ export const refreshAppleAccessToken = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: "asia-northeast3", }, async (request) => { // 인증 확인 @@ -267,7 +267,7 @@ export const refreshAppleAccessToken = onCall({ export const revokeAppleAccessToken = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: "asia-northeast3", }, async (request) => { // 인증 확인 diff --git a/Firebase/functions/src/auth/github.ts b/Firebase/functions/src/auth/github.ts index 19a0391f..d1fc7b05 100644 --- a/Firebase/functions/src/auth/github.ts +++ b/Firebase/functions/src/auth/github.ts @@ -5,7 +5,7 @@ import axios from "axios"; // GitHub OAuth 인증 및 커스텀 토큰 발급 함수 export const requestGithubTokens = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: "asia-northeast3", }, async (request) => { try { @@ -103,7 +103,7 @@ export const requestGithubTokens = onCall({ export const revokeGithubAccessToken = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: "asia-northeast3", }, async (request) => { try { diff --git a/Firebase/functions/src/fcm/notification.ts b/Firebase/functions/src/fcm/notification.ts index 279da8ac..b51d01ef 100644 --- a/Firebase/functions/src/fcm/notification.ts +++ b/Firebase/functions/src/fcm/notification.ts @@ -18,6 +18,7 @@ type FirestoreErrorLike = { // Cloud Tasks에 의해 트리거되는 함수 export const sendPushNotification = onTaskDispatched({ + maxInstances: 2, region: "asia-northeast3", retryConfig: { maxAttempts: 3, minBackoffSeconds: 5 }, rateLimits: { maxDispatchesPerSecond: 200 }, diff --git a/Firebase/functions/src/fcm/schedule.ts b/Firebase/functions/src/fcm/schedule.ts index 72945c9b..1ce79c00 100644 --- a/Firebase/functions/src/fcm/schedule.ts +++ b/Firebase/functions/src/fcm/schedule.ts @@ -25,6 +25,7 @@ type ErrorLike = { }; export const scheduleTodoReminder = onSchedule({ + maxInstances: 1, region: LOCATION, schedule: "*/5 * * * *", timeZone: "UTC" diff --git a/Firebase/functions/src/notification/deletion.ts b/Firebase/functions/src/notification/deletion.ts index 13a6620e..95b1f66e 100644 --- a/Firebase/functions/src/notification/deletion.ts +++ b/Firebase/functions/src/notification/deletion.ts @@ -16,7 +16,7 @@ type NotificationDeletionTaskData = { export const requestPushNotificationDeletion = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: LOCATION, }, async (request) => { @@ -94,7 +94,7 @@ export const requestPushNotificationDeletion = onCall({ export const undoPushNotificationDeletion = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: LOCATION, }, async (request) => { @@ -147,6 +147,7 @@ export const undoPushNotificationDeletion = onCall({ ); export const completePushNotificationDeletion = onTaskDispatched({ + maxInstances: 1, region: LOCATION, retryConfig: {maxAttempts: 3, minBackoffSeconds: 5}, rateLimits: {maxDispatchesPerSecond: 200}, diff --git a/Firebase/functions/src/todo/cleanup.ts b/Firebase/functions/src/todo/cleanup.ts index 881a0173..fcc1031c 100644 --- a/Firebase/functions/src/todo/cleanup.ts +++ b/Firebase/functions/src/todo/cleanup.ts @@ -8,6 +8,7 @@ const DELETE_BATCH_SIZE = 200; const QUERY_BATCH_SIZE = 100; export const removeTodoNotificationDocuments = onDocumentDeleted({ + maxInstances: 1, document: "users/{userId}/todoLists/{todoId}", region: LOCATION }, @@ -29,6 +30,7 @@ export const removeTodoNotificationDocuments = onDocumentDeleted({ ); export const removeCompletedTodoNotificationRecords = onDocumentUpdated({ + maxInstances: 1, document: "users/{userId}/todoLists/{todoId}", region: LOCATION }, @@ -64,6 +66,7 @@ export const removeCompletedTodoNotificationRecords = onDocumentUpdated({ ); export const cleanupUnusedTodoNotificationRecords = onSchedule({ + maxInstances: 1, region: LOCATION, schedule: "0 * * * *", timeZone: "UTC" diff --git a/Firebase/functions/src/todo/deletion.ts b/Firebase/functions/src/todo/deletion.ts index 2490a0a7..b62cf491 100644 --- a/Firebase/functions/src/todo/deletion.ts +++ b/Firebase/functions/src/todo/deletion.ts @@ -17,7 +17,7 @@ type TodoDeletionTaskData = { export const requestTodoDeletion = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: LOCATION, }, async (request) => { @@ -105,7 +105,7 @@ export const requestTodoDeletion = onCall({ export const undoTodoDeletion = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: LOCATION, }, async (request) => { @@ -163,6 +163,7 @@ export const undoTodoDeletion = onCall({ ); export const completeTodoDeletion = onTaskDispatched({ + maxInstances: 1, region: LOCATION, retryConfig: {maxAttempts: 3, minBackoffSeconds: 5}, rateLimits: {maxDispatchesPerSecond: 200}, diff --git a/Firebase/functions/src/todo/update.ts b/Firebase/functions/src/todo/update.ts index 930869be..d08996ea 100644 --- a/Firebase/functions/src/todo/update.ts +++ b/Firebase/functions/src/todo/update.ts @@ -7,6 +7,7 @@ const LOCATION = "asia-northeast3"; const BATCH_SIZE = 200; export const syncTodoNotificationCategory = onDocumentUpdated({ + maxInstances: 1, document: "users/{userId}/todoLists/{todoId}", region: LOCATION }, diff --git a/Firebase/functions/src/todoCategory/update.ts b/Firebase/functions/src/todoCategory/update.ts index 1aee0eb6..2052c6d1 100644 --- a/Firebase/functions/src/todoCategory/update.ts +++ b/Firebase/functions/src/todoCategory/update.ts @@ -21,6 +21,7 @@ type TodoCategoryUpdateTaskData = { }; export const requestMoveRemovedCategoryTodosToEtc = onDocumentUpdated({ + maxInstances: 1, document: "users/{userId}/userData/categories", region: LOCATION }, @@ -80,6 +81,7 @@ export const requestMoveRemovedCategoryTodosToEtc = onDocumentUpdated({ ); export const completeMoveRemovedCategoryTodosToEtc = onTaskDispatched({ + maxInstances: 1, region: LOCATION, retryConfig: { maxAttempts: 3, minBackoffSeconds: 5 }, rateLimits: { maxDispatchesPerSecond: 20 }, diff --git a/Firebase/functions/src/user/delete.ts b/Firebase/functions/src/user/delete.ts index 006085a4..8cfa69d4 100644 --- a/Firebase/functions/src/user/delete.ts +++ b/Firebase/functions/src/user/delete.ts @@ -3,6 +3,9 @@ import * as admin from "firebase-admin"; import * as logger from "firebase-functions/logger"; export const cleanupDeletedUserFirestoreData = functions + .runWith({ + maxInstances: 1 + }) .region("asia-northeast3") .auth .user() diff --git a/Firebase/functions/src/webPage/deletion.ts b/Firebase/functions/src/webPage/deletion.ts index 52145449..76470ecc 100644 --- a/Firebase/functions/src/webPage/deletion.ts +++ b/Firebase/functions/src/webPage/deletion.ts @@ -17,7 +17,7 @@ type WebPageDeletionTaskData = { export const requestWebPageDeletion = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: LOCATION, }, async (request) => { @@ -101,7 +101,7 @@ export const requestWebPageDeletion = onCall({ export const undoWebPageDeletion = onCall({ cors: true, - maxInstances: 10, + maxInstances: 3, region: LOCATION, }, async (request) => { @@ -163,6 +163,7 @@ export const undoWebPageDeletion = onCall({ ); export const completeWebPageDeletion = onTaskDispatched({ + maxInstances: 1, region: LOCATION, retryConfig: { maxAttempts: 3, minBackoffSeconds: 5 }, rateLimits: { maxDispatchesPerSecond: 200 },