Skip to content

Commit bc71a98

Browse files
committed
feat(firebase): remove firebase-functions as dependency
1 parent 4b8472e commit bc71a98

File tree

4 files changed

+45
-160
lines changed

4 files changed

+45
-160
lines changed

packages/node/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
"@sentry/core": "10.20.0",
9999
"@sentry/node-core": "10.20.0",
100100
"@sentry/opentelemetry": "10.20.0",
101-
"firebase-functions": "^6.5.0",
102101
"import-in-the-middle": "^1.14.2",
103102
"minimatch": "^9.0.0"
104103
},

packages/node/src/integrations/tracing/firebase/otel/patches/functions.ts

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,15 @@ import {
88
safeExecuteInTheMiddle,
99
} from '@opentelemetry/instrumentation';
1010
import type { SpanAttributes } from '@sentry/core';
11-
import type {
12-
onDocumentCreated,
13-
onDocumentCreatedWithAuthContext,
14-
onDocumentDeleted,
15-
onDocumentDeletedWithAuthContext,
16-
onDocumentUpdated,
17-
onDocumentUpdatedWithAuthContext,
18-
onDocumentWritten,
19-
onDocumentWrittenWithAuthContext,
20-
} from 'firebase-functions/firestore';
21-
import type { onCall, onRequest } from 'firebase-functions/https';
22-
import type { onSchedule } from 'firebase-functions/scheduler';
23-
import type {
24-
onObjectArchived,
25-
onObjectDeleted,
26-
onObjectFinalized,
27-
onObjectMetadataUpdated,
28-
} from 'firebase-functions/storage';
2911
import type { FirebaseInstrumentation } from '../firebaseInstrumentation';
30-
import type { FirebaseInstrumentationConfig, RequestHook, ResponseHook } from '../types';
12+
import type {
13+
AvailableFirebaseFunctions,
14+
FirebaseFunctions,
15+
FirebaseInstrumentationConfig,
16+
OverloadedParameters,
17+
RequestHook,
18+
ResponseHook,
19+
} from '../types';
3120

3221
/**
3322
* Patches Firebase Functions v2 to add OpenTelemetry instrumentation
@@ -109,41 +98,6 @@ export function patchFunctions(
10998
return moduleFunctionsCJS;
11099
}
111100

112-
type OverloadedParameters<T> = T extends {
113-
(...args: infer A1): unknown;
114-
(...args: infer A2): unknown;
115-
(...args: infer A3): unknown;
116-
(...args: infer A4): unknown;
117-
}
118-
? A1 | A2 | A3 | A4
119-
: T extends { (...args: infer A1): unknown; (...args: infer A2): unknown; (...args: infer A3): unknown }
120-
? A1 | A2 | A3
121-
: T extends { (...args: infer A1): unknown; (...args: infer A2): unknown }
122-
? A1 | A2
123-
: T extends (...args: infer A) => unknown
124-
? A
125-
: unknown;
126-
127-
type AvailableFirebaseFunctions = {
128-
onRequest: typeof onRequest;
129-
onCall: typeof onCall;
130-
onDocumentCreated: typeof onDocumentCreated;
131-
onDocumentUpdated: typeof onDocumentUpdated;
132-
onDocumentDeleted: typeof onDocumentDeleted;
133-
onDocumentWritten: typeof onDocumentWritten;
134-
onDocumentCreatedWithAuthContext: typeof onDocumentCreatedWithAuthContext;
135-
onDocumentUpdatedWithAuthContext: typeof onDocumentUpdatedWithAuthContext;
136-
onDocumentDeletedWithAuthContext: typeof onDocumentDeletedWithAuthContext;
137-
onDocumentWrittenWithAuthContext: typeof onDocumentWrittenWithAuthContext;
138-
onSchedule: typeof onSchedule;
139-
onObjectFinalized: typeof onObjectFinalized;
140-
onObjectArchived: typeof onObjectArchived;
141-
onObjectDeleted: typeof onObjectDeleted;
142-
onObjectMetadataUpdated: typeof onObjectMetadataUpdated;
143-
};
144-
145-
type FirebaseFunctions = AvailableFirebaseFunctions[keyof AvailableFirebaseFunctions];
146-
147101
/**
148102
* Async function to execute patched function and being able to catch errors
149103
* @param execute - function to be executed

packages/node/src/integrations/tracing/firebase/otel/types.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,40 @@ export type AddDocType<AppModelType, DbModelType extends DocumentData> = (
128128
export type DeleteDocType<AppModelType, DbModelType extends DocumentData> = (
129129
reference: DocumentReference<AppModelType, DbModelType>,
130130
) => Promise<void>;
131+
132+
export type OverloadedParameters<T> = T extends {
133+
(...args: infer A1): unknown;
134+
(...args: infer A2): unknown;
135+
}
136+
? A1 | A2
137+
: T extends (...args: infer A) => unknown
138+
? A
139+
: unknown;
140+
141+
/**
142+
* A bare minimum of how Cloud Functions for Firebase (v2) are defined.
143+
*/
144+
export type FirebaseFunctions =
145+
| ((handler: () => Promise<unknown> | unknown) => (...args: unknown[]) => Promise<unknown> | unknown)
146+
| ((
147+
documentOrOptions: string | string[] | Record<string, unknown>,
148+
handler: () => Promise<unknown> | unknown,
149+
) => (...args: unknown[]) => Promise<unknown> | unknown);
150+
151+
export type AvailableFirebaseFunctions = {
152+
onRequest: FirebaseFunctions;
153+
onCall: FirebaseFunctions;
154+
onDocumentCreated: FirebaseFunctions;
155+
onDocumentUpdated: FirebaseFunctions;
156+
onDocumentDeleted: FirebaseFunctions;
157+
onDocumentWritten: FirebaseFunctions;
158+
onDocumentCreatedWithAuthContext: FirebaseFunctions;
159+
onDocumentUpdatedWithAuthContext: FirebaseFunctions;
160+
onDocumentDeletedWithAuthContext: FirebaseFunctions;
161+
onDocumentWrittenWithAuthContext: FirebaseFunctions;
162+
onSchedule: FirebaseFunctions;
163+
onObjectFinalized: FirebaseFunctions;
164+
onObjectArchived: FirebaseFunctions;
165+
onObjectDeleted: FirebaseFunctions;
166+
onObjectMetadataUpdated: FirebaseFunctions;
167+
};

yarn.lock

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -8272,13 +8272,6 @@
82728272
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.12.tgz#6b2c510a7ad7039e98e7b8d3d6598f4359e5c080"
82738273
integrity sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==
82748274

8275-
"@types/cors@^2.8.5":
8276-
version "2.8.19"
8277-
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.19.tgz#d93ea2673fd8c9f697367f5eeefc2bbfa94f0342"
8278-
integrity sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==
8279-
dependencies:
8280-
"@types/node" "*"
8281-
82828275
"@types/css-font-loading-module@0.0.7":
82838276
version "0.0.7"
82848277
resolved "https://registry.yarnpkg.com/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz#2f98ede46acc0975de85c0b7b0ebe06041d24601"
@@ -8541,16 +8534,6 @@
85418534
"@types/qs" "*"
85428535
"@types/serve-static" "*"
85438536

8544-
"@types/express@^4.17.21":
8545-
version "4.17.23"
8546-
resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.23.tgz#35af3193c640bfd4d7fe77191cd0ed411a433bef"
8547-
integrity sha512-Crp6WY9aTYP3qPi2wGDo9iUe/rceX01UMhnF1jmwDcKCFM6cx7YhGP/Mpr3y9AASpfHixIG0E6azCcL5OcDHsQ==
8548-
dependencies:
8549-
"@types/body-parser" "*"
8550-
"@types/express-serve-static-core" "^4.17.33"
8551-
"@types/qs" "*"
8552-
"@types/serve-static" "*"
8553-
85548537
"@types/fs-extra@^5.0.5":
85558538
version "5.1.0"
85568539
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-5.1.0.tgz#2a325ef97901504a3828718c390d34b8426a10a1"
@@ -8797,13 +8780,6 @@
87978780
dependencies:
87988781
undici-types "~6.20.0"
87998782

8800-
"@types/node@>=13.7.0":
8801-
version "24.7.2"
8802-
resolved "https://registry.yarnpkg.com/@types/node/-/node-24.7.2.tgz#5adf66b6e2ac5cab1d10a2ad3682e359cb652f4a"
8803-
integrity sha512-/NbVmcGTP+lj5oa4yiYxxeBjRivKQ5Ns1eSZeB99ExsEQ6rX5XYU1Zy/gGxY/ilqtD4Etx9mKyrPxZRetiahhA==
8804-
dependencies:
8805-
undici-types "~7.14.0"
8806-
88078783
"@types/node@^10.1.0":
88088784
version "10.17.60"
88098785
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
@@ -16775,43 +16751,6 @@ express@^4.10.7, express@^4.17.1, express@^4.17.3, express@^4.18.1, express@^4.2
1677516751
utils-merge "1.0.1"
1677616752
vary "~1.1.2"
1677716753

16778-
express@^4.21.0:
16779-
version "4.21.2"
16780-
resolved "https://registry.yarnpkg.com/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32"
16781-
integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==
16782-
dependencies:
16783-
accepts "~1.3.8"
16784-
array-flatten "1.1.1"
16785-
body-parser "1.20.3"
16786-
content-disposition "0.5.4"
16787-
content-type "~1.0.4"
16788-
cookie "0.7.1"
16789-
cookie-signature "1.0.6"
16790-
debug "2.6.9"
16791-
depd "2.0.0"
16792-
encodeurl "~2.0.0"
16793-
escape-html "~1.0.3"
16794-
etag "~1.8.1"
16795-
finalhandler "1.3.1"
16796-
fresh "0.5.2"
16797-
http-errors "2.0.0"
16798-
merge-descriptors "1.0.3"
16799-
methods "~1.1.2"
16800-
on-finished "2.4.1"
16801-
parseurl "~1.3.3"
16802-
path-to-regexp "0.1.12"
16803-
proxy-addr "~2.0.7"
16804-
qs "6.13.0"
16805-
range-parser "~1.2.1"
16806-
safe-buffer "5.2.1"
16807-
send "0.19.0"
16808-
serve-static "1.16.2"
16809-
setprototypeof "1.2.0"
16810-
statuses "2.0.1"
16811-
type-is "~1.6.18"
16812-
utils-merge "1.0.1"
16813-
vary "~1.1.2"
16814-
1681516754
exsolve@^1.0.4, exsolve@^1.0.7:
1681616755
version "1.0.7"
1681716756
resolved "https://registry.yarnpkg.com/exsolve/-/exsolve-1.0.7.tgz#3b74e4c7ca5c5f9a19c3626ca857309fa99f9e9e"
@@ -17339,17 +17278,6 @@ findup-sync@^4.0.0:
1733917278
micromatch "^4.0.2"
1734017279
resolve-dir "^1.0.1"
1734117280

17342-
firebase-functions@^6.5.0:
17343-
version "6.5.0"
17344-
resolved "https://registry.yarnpkg.com/firebase-functions/-/firebase-functions-6.5.0.tgz#0324babc47afbc4e10a3a5b9b289bd0f763e6ff8"
17345-
integrity sha512-ffntJkq88K0pdLDq14IyetKQu99Je4vBBJBe9rkZK2X4QyeJJnmA527+v2iTKA+SwRtxf5lh7sXgxpvxGS8HtQ==
17346-
dependencies:
17347-
"@types/cors" "^2.8.5"
17348-
"@types/express" "^4.17.21"
17349-
cors "^2.8.5"
17350-
express "^4.21.0"
17351-
protobufjs "^7.2.2"
17352-
1735317281
fireworm@^0.7.2:
1735417282
version "0.7.2"
1735517283
resolved "https://registry.yarnpkg.com/fireworm/-/fireworm-0.7.2.tgz#bc5736515b48bd30bf3293a2062e0b0e0361537a"
@@ -21402,11 +21330,6 @@ long@^4.0.0:
2140221330
resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
2140321331
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==
2140421332

21405-
long@^5.0.0:
21406-
version "5.3.2"
21407-
resolved "https://registry.yarnpkg.com/long/-/long-5.3.2.tgz#1d84463095999262d7d7b7f8bfd4a8cc55167f83"
21408-
integrity sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==
21409-
2141021333
long@^5.2.1:
2141121334
version "5.2.3"
2141221335
resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1"
@@ -24829,11 +24752,6 @@ path-to-regexp@0.1.10:
2482924752
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b"
2483024753
integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==
2483124754

24832-
path-to-regexp@0.1.12:
24833-
version "0.1.12"
24834-
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7"
24835-
integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==
24836-
2483724755
path-to-regexp@3.3.0:
2483824756
version "3.3.0"
2483924757
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-3.3.0.tgz#f7f31d32e8518c2660862b644414b6d5c63a611b"
@@ -26113,24 +26031,6 @@ property-information@^6.0.0:
2611326031
resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.3.0.tgz#ba4a06ec6b4e1e90577df9931286953cdf4282c3"
2611426032
integrity sha512-gVNZ74nqhRMiIUYWGQdosYetaKc83x8oT41a0LlV3AAFCAZwCpg4vmGkq8t34+cUhp3cnM4XDiU/7xlgK7HGrg==
2611526033

26116-
protobufjs@^7.2.2:
26117-
version "7.5.4"
26118-
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.5.4.tgz#885d31fe9c4b37f25d1bb600da30b1c5b37d286a"
26119-
integrity sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg==
26120-
dependencies:
26121-
"@protobufjs/aspromise" "^1.1.2"
26122-
"@protobufjs/base64" "^1.1.2"
26123-
"@protobufjs/codegen" "^2.0.4"
26124-
"@protobufjs/eventemitter" "^1.1.0"
26125-
"@protobufjs/fetch" "^1.1.0"
26126-
"@protobufjs/float" "^1.0.2"
26127-
"@protobufjs/inquire" "^1.1.0"
26128-
"@protobufjs/path" "^1.1.2"
26129-
"@protobufjs/pool" "^1.1.0"
26130-
"@protobufjs/utf8" "^1.1.0"
26131-
"@types/node" ">=13.7.0"
26132-
long "^5.0.0"
26133-
2613426034
protocols@^2.0.0, protocols@^2.0.1:
2613526035
version "2.0.1"
2613626036
resolved "https://registry.yarnpkg.com/protocols/-/protocols-2.0.1.tgz#8f155da3fc0f32644e83c5782c8e8212ccf70a86"
@@ -30304,11 +30204,6 @@ undici-types@~6.20.0:
3030430204
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
3030530205
integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==
3030630206

30307-
undici-types@~7.14.0:
30308-
version "7.14.0"
30309-
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.14.0.tgz#4c037b32ca4d7d62fae042174604341588bc0840"
30310-
integrity sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==
30311-
3031230207
undici@^5.25.4, undici@^5.28.5:
3031330208
version "5.29.0"
3031430209
resolved "https://registry.yarnpkg.com/undici/-/undici-5.29.0.tgz#419595449ae3f2cdcba3580a2e8903399bd1f5a3"

0 commit comments

Comments
 (0)