@sentry/node 9.34.0 → 9.36.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (505) hide show
  1. package/build/cjs/index.js +48 -56
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/featureFlagShims/launchDarkly.js +43 -0
  4. package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -0
  5. package/build/cjs/integrations/featureFlagShims/openFeature.js +55 -0
  6. package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -0
  7. package/build/cjs/integrations/featureFlagShims/statsig.js +23 -0
  8. package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -0
  9. package/build/cjs/integrations/featureFlagShims/unleash.js +23 -0
  10. package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -0
  11. package/build/cjs/integrations/fs.js +2 -2
  12. package/build/cjs/integrations/fs.js.map +1 -1
  13. package/build/cjs/integrations/http/index.js +7 -11
  14. package/build/cjs/integrations/http/index.js.map +1 -1
  15. package/build/cjs/integrations/node-fetch/index.js +4 -5
  16. package/build/cjs/integrations/node-fetch/index.js.map +1 -1
  17. package/build/cjs/integrations/tracing/amqplib.js +4 -5
  18. package/build/cjs/integrations/tracing/amqplib.js.map +1 -1
  19. package/build/cjs/integrations/tracing/connect.js +3 -4
  20. package/build/cjs/integrations/tracing/connect.js.map +1 -1
  21. package/build/cjs/integrations/tracing/dataloader.js +3 -3
  22. package/build/cjs/integrations/tracing/dataloader.js.map +1 -1
  23. package/build/cjs/integrations/tracing/express.js +5 -7
  24. package/build/cjs/integrations/tracing/express.js.map +1 -1
  25. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js +5 -10
  26. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  27. package/build/cjs/integrations/tracing/fastify/index.js +6 -6
  28. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
  29. package/build/cjs/integrations/tracing/genericPool.js +3 -3
  30. package/build/cjs/integrations/tracing/genericPool.js.map +1 -1
  31. package/build/cjs/integrations/tracing/graphql.js +3 -4
  32. package/build/cjs/integrations/tracing/graphql.js.map +1 -1
  33. package/build/cjs/integrations/tracing/hapi/index.js +3 -4
  34. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  35. package/build/cjs/integrations/tracing/kafka.js +4 -5
  36. package/build/cjs/integrations/tracing/kafka.js.map +1 -1
  37. package/build/cjs/integrations/tracing/knex.js +3 -3
  38. package/build/cjs/integrations/tracing/knex.js.map +1 -1
  39. package/build/cjs/integrations/tracing/koa.js +4 -6
  40. package/build/cjs/integrations/tracing/koa.js.map +1 -1
  41. package/build/cjs/integrations/tracing/lrumemoizer.js +2 -2
  42. package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -1
  43. package/build/cjs/integrations/tracing/mongo.js +3 -4
  44. package/build/cjs/integrations/tracing/mongo.js.map +1 -1
  45. package/build/cjs/integrations/tracing/mongoose.js +3 -4
  46. package/build/cjs/integrations/tracing/mongoose.js.map +1 -1
  47. package/build/cjs/integrations/tracing/mysql.js +2 -2
  48. package/build/cjs/integrations/tracing/mysql.js.map +1 -1
  49. package/build/cjs/integrations/tracing/mysql2.js +3 -4
  50. package/build/cjs/integrations/tracing/mysql2.js.map +1 -1
  51. package/build/cjs/integrations/tracing/postgres.js +3 -4
  52. package/build/cjs/integrations/tracing/postgres.js.map +1 -1
  53. package/build/cjs/integrations/tracing/postgresjs.js +3 -4
  54. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  55. package/build/cjs/integrations/tracing/prisma.js +2 -2
  56. package/build/cjs/integrations/tracing/prisma.js.map +1 -1
  57. package/build/cjs/integrations/tracing/redis.js +3 -3
  58. package/build/cjs/integrations/tracing/redis.js.map +1 -1
  59. package/build/cjs/integrations/tracing/tedious.js +3 -3
  60. package/build/cjs/integrations/tracing/tedious.js.map +1 -1
  61. package/build/cjs/integrations/tracing/vercelai/index.js +2 -2
  62. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  63. package/build/cjs/preload.js +2 -2
  64. package/build/cjs/preload.js.map +1 -1
  65. package/build/cjs/sdk/index.js +22 -203
  66. package/build/cjs/sdk/index.js.map +1 -1
  67. package/build/cjs/sdk/initOtel.js +4 -22
  68. package/build/cjs/sdk/initOtel.js.map +1 -1
  69. package/build/esm/index.js +6 -21
  70. package/build/esm/index.js.map +1 -1
  71. package/build/esm/integrations/featureFlagShims/launchDarkly.js +40 -0
  72. package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -0
  73. package/build/esm/integrations/featureFlagShims/openFeature.js +52 -0
  74. package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -0
  75. package/build/esm/integrations/featureFlagShims/statsig.js +21 -0
  76. package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -0
  77. package/build/esm/integrations/featureFlagShims/unleash.js +21 -0
  78. package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -0
  79. package/build/esm/integrations/fs.js +1 -1
  80. package/build/esm/integrations/fs.js.map +1 -1
  81. package/build/esm/integrations/http/index.js +1 -5
  82. package/build/esm/integrations/http/index.js.map +1 -1
  83. package/build/esm/integrations/node-fetch/index.js +2 -3
  84. package/build/esm/integrations/node-fetch/index.js.map +1 -1
  85. package/build/esm/integrations/tracing/amqplib.js +1 -2
  86. package/build/esm/integrations/tracing/amqplib.js.map +1 -1
  87. package/build/esm/integrations/tracing/connect.js +1 -2
  88. package/build/esm/integrations/tracing/connect.js.map +1 -1
  89. package/build/esm/integrations/tracing/dataloader.js +1 -1
  90. package/build/esm/integrations/tracing/dataloader.js.map +1 -1
  91. package/build/esm/integrations/tracing/express.js +2 -4
  92. package/build/esm/integrations/tracing/express.js.map +1 -1
  93. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js +5 -10
  94. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  95. package/build/esm/integrations/tracing/fastify/index.js +5 -5
  96. package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
  97. package/build/esm/integrations/tracing/genericPool.js +1 -1
  98. package/build/esm/integrations/tracing/genericPool.js.map +1 -1
  99. package/build/esm/integrations/tracing/graphql.js +2 -3
  100. package/build/esm/integrations/tracing/graphql.js.map +1 -1
  101. package/build/esm/integrations/tracing/hapi/index.js +1 -2
  102. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  103. package/build/esm/integrations/tracing/kafka.js +1 -2
  104. package/build/esm/integrations/tracing/kafka.js.map +1 -1
  105. package/build/esm/integrations/tracing/knex.js +1 -1
  106. package/build/esm/integrations/tracing/knex.js.map +1 -1
  107. package/build/esm/integrations/tracing/koa.js +2 -4
  108. package/build/esm/integrations/tracing/koa.js.map +1 -1
  109. package/build/esm/integrations/tracing/lrumemoizer.js +1 -1
  110. package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -1
  111. package/build/esm/integrations/tracing/mongo.js +1 -2
  112. package/build/esm/integrations/tracing/mongo.js.map +1 -1
  113. package/build/esm/integrations/tracing/mongoose.js +1 -2
  114. package/build/esm/integrations/tracing/mongoose.js.map +1 -1
  115. package/build/esm/integrations/tracing/mysql.js +1 -1
  116. package/build/esm/integrations/tracing/mysql.js.map +1 -1
  117. package/build/esm/integrations/tracing/mysql2.js +1 -2
  118. package/build/esm/integrations/tracing/mysql2.js.map +1 -1
  119. package/build/esm/integrations/tracing/postgres.js +1 -2
  120. package/build/esm/integrations/tracing/postgres.js.map +1 -1
  121. package/build/esm/integrations/tracing/postgresjs.js +2 -3
  122. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  123. package/build/esm/integrations/tracing/prisma.js +1 -1
  124. package/build/esm/integrations/tracing/prisma.js.map +1 -1
  125. package/build/esm/integrations/tracing/redis.js +1 -1
  126. package/build/esm/integrations/tracing/redis.js.map +1 -1
  127. package/build/esm/integrations/tracing/tedious.js +1 -1
  128. package/build/esm/integrations/tracing/tedious.js.map +1 -1
  129. package/build/esm/integrations/tracing/vercelai/index.js +1 -1
  130. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  131. package/build/esm/package.json +1 -1
  132. package/build/esm/preload.js +1 -1
  133. package/build/esm/preload.js.map +1 -1
  134. package/build/esm/sdk/index.js +22 -202
  135. package/build/esm/sdk/index.js.map +1 -1
  136. package/build/esm/sdk/initOtel.js +3 -21
  137. package/build/esm/sdk/initOtel.js.map +1 -1
  138. package/build/types/index.d.ts +3 -21
  139. package/build/types/index.d.ts.map +1 -1
  140. package/build/types/integrations/featureFlagShims/index.d.ts +5 -0
  141. package/build/types/integrations/featureFlagShims/index.d.ts.map +1 -0
  142. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts +10 -0
  143. package/build/types/integrations/featureFlagShims/launchDarkly.d.ts.map +1 -0
  144. package/build/types/integrations/featureFlagShims/openFeature.d.ts +23 -0
  145. package/build/types/integrations/featureFlagShims/openFeature.d.ts.map +1 -0
  146. package/build/types/integrations/featureFlagShims/statsig.d.ts +6 -0
  147. package/build/types/integrations/featureFlagShims/statsig.d.ts.map +1 -0
  148. package/build/types/integrations/featureFlagShims/unleash.d.ts +6 -0
  149. package/build/types/integrations/featureFlagShims/unleash.d.ts.map +1 -0
  150. package/build/types/integrations/http/index.d.ts +1 -1
  151. package/build/types/integrations/http/index.d.ts.map +1 -1
  152. package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
  153. package/build/types/integrations/tracing/amqplib.d.ts.map +1 -1
  154. package/build/types/integrations/tracing/connect.d.ts.map +1 -1
  155. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  156. package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
  157. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  158. package/build/types/integrations/tracing/kafka.d.ts.map +1 -1
  159. package/build/types/integrations/tracing/koa.d.ts.map +1 -1
  160. package/build/types/integrations/tracing/mongo.d.ts.map +1 -1
  161. package/build/types/integrations/tracing/mongoose.d.ts.map +1 -1
  162. package/build/types/integrations/tracing/mysql2.d.ts.map +1 -1
  163. package/build/types/integrations/tracing/postgres.d.ts.map +1 -1
  164. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
  165. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  166. package/build/types/sdk/index.d.ts +2 -6
  167. package/build/types/sdk/index.d.ts.map +1 -1
  168. package/build/types/sdk/initOtel.d.ts +1 -1
  169. package/build/types/sdk/initOtel.d.ts.map +1 -1
  170. package/build/types/types.d.ts +1 -1
  171. package/build/types/types.d.ts.map +1 -1
  172. package/build/types-ts3.8/index.d.ts +3 -21
  173. package/build/types-ts3.8/integrations/featureFlagShims/index.d.ts +5 -0
  174. package/build/types-ts3.8/integrations/featureFlagShims/launchDarkly.d.ts +10 -0
  175. package/build/types-ts3.8/integrations/featureFlagShims/openFeature.d.ts +23 -0
  176. package/build/types-ts3.8/integrations/featureFlagShims/statsig.d.ts +6 -0
  177. package/build/types-ts3.8/integrations/featureFlagShims/unleash.d.ts +6 -0
  178. package/build/types-ts3.8/integrations/http/index.d.ts +1 -1
  179. package/build/types-ts3.8/sdk/index.d.ts +2 -6
  180. package/build/types-ts3.8/sdk/initOtel.d.ts +1 -1
  181. package/build/types-ts3.8/types.d.ts +1 -1
  182. package/package.json +4 -3
  183. package/build/cjs/cron/common.js +0 -56
  184. package/build/cjs/cron/common.js.map +0 -1
  185. package/build/cjs/cron/cron.js +0 -112
  186. package/build/cjs/cron/cron.js.map +0 -1
  187. package/build/cjs/cron/index.js +0 -15
  188. package/build/cjs/cron/index.js.map +0 -1
  189. package/build/cjs/cron/node-cron.js +0 -71
  190. package/build/cjs/cron/node-cron.js.map +0 -1
  191. package/build/cjs/cron/node-schedule.js +0 -65
  192. package/build/cjs/cron/node-schedule.js.map +0 -1
  193. package/build/cjs/integrations/anr/index.js +0 -238
  194. package/build/cjs/integrations/anr/index.js.map +0 -1
  195. package/build/cjs/integrations/childProcess.js +0 -100
  196. package/build/cjs/integrations/childProcess.js.map +0 -1
  197. package/build/cjs/integrations/context.js +0 -457
  198. package/build/cjs/integrations/context.js.map +0 -1
  199. package/build/cjs/integrations/contextlines.js +0 -405
  200. package/build/cjs/integrations/contextlines.js.map +0 -1
  201. package/build/cjs/integrations/http/SentryHttpInstrumentation.js +0 -558
  202. package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  203. package/build/cjs/integrations/local-variables/common.js +0 -69
  204. package/build/cjs/integrations/local-variables/common.js.map +0 -1
  205. package/build/cjs/integrations/local-variables/index.js +0 -12
  206. package/build/cjs/integrations/local-variables/index.js.map +0 -1
  207. package/build/cjs/integrations/local-variables/local-variables-async.js +0 -143
  208. package/build/cjs/integrations/local-variables/local-variables-async.js.map +0 -1
  209. package/build/cjs/integrations/local-variables/local-variables-sync.js +0 -410
  210. package/build/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
  211. package/build/cjs/integrations/modules.js +0 -135
  212. package/build/cjs/integrations/modules.js.map +0 -1
  213. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -291
  214. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  215. package/build/cjs/integrations/onuncaughtexception.js +0 -134
  216. package/build/cjs/integrations/onuncaughtexception.js.map +0 -1
  217. package/build/cjs/integrations/onunhandledrejection.js +0 -89
  218. package/build/cjs/integrations/onunhandledrejection.js.map +0 -1
  219. package/build/cjs/integrations/processSession.js +0 -36
  220. package/build/cjs/integrations/processSession.js.map +0 -1
  221. package/build/cjs/integrations/spotlight.js +0 -101
  222. package/build/cjs/integrations/spotlight.js.map +0 -1
  223. package/build/cjs/integrations/winston.js +0 -151
  224. package/build/cjs/integrations/winston.js.map +0 -1
  225. package/build/cjs/logs/capture.js +0 -29
  226. package/build/cjs/logs/capture.js.map +0 -1
  227. package/build/cjs/logs/exports.js +0 -178
  228. package/build/cjs/logs/exports.js.map +0 -1
  229. package/build/cjs/nodeVersion.js +0 -12
  230. package/build/cjs/nodeVersion.js.map +0 -1
  231. package/build/cjs/otel/contextManager.js +0 -16
  232. package/build/cjs/otel/contextManager.js.map +0 -1
  233. package/build/cjs/otel/instrument.js +0 -139
  234. package/build/cjs/otel/instrument.js.map +0 -1
  235. package/build/cjs/proxy/base.js +0 -122
  236. package/build/cjs/proxy/base.js.map +0 -1
  237. package/build/cjs/proxy/index.js +0 -173
  238. package/build/cjs/proxy/index.js.map +0 -1
  239. package/build/cjs/proxy/parse-proxy-response.js +0 -104
  240. package/build/cjs/proxy/parse-proxy-response.js.map +0 -1
  241. package/build/cjs/sdk/api.js +0 -117
  242. package/build/cjs/sdk/api.js.map +0 -1
  243. package/build/cjs/sdk/client.js +0 -156
  244. package/build/cjs/sdk/client.js.map +0 -1
  245. package/build/cjs/transports/http.js +0 -158
  246. package/build/cjs/transports/http.js.map +0 -1
  247. package/build/cjs/utils/addOriginToSpan.js +0 -11
  248. package/build/cjs/utils/addOriginToSpan.js.map +0 -1
  249. package/build/cjs/utils/baggage.js +0 -36
  250. package/build/cjs/utils/baggage.js.map +0 -1
  251. package/build/cjs/utils/commonjs.js +0 -13
  252. package/build/cjs/utils/commonjs.js.map +0 -1
  253. package/build/cjs/utils/createMissingInstrumentationContext.js +0 -11
  254. package/build/cjs/utils/createMissingInstrumentationContext.js.map +0 -1
  255. package/build/cjs/utils/debug.js +0 -23
  256. package/build/cjs/utils/debug.js.map +0 -1
  257. package/build/cjs/utils/ensureIsWrapped.js +0 -41
  258. package/build/cjs/utils/ensureIsWrapped.js.map +0 -1
  259. package/build/cjs/utils/envToBool.js +0 -32
  260. package/build/cjs/utils/envToBool.js.map +0 -1
  261. package/build/cjs/utils/errorhandling.js +0 -42
  262. package/build/cjs/utils/errorhandling.js.map +0 -1
  263. package/build/cjs/utils/getRequestUrl.js +0 -18
  264. package/build/cjs/utils/getRequestUrl.js.map +0 -1
  265. package/build/cjs/utils/module.js +0 -60
  266. package/build/cjs/utils/module.js.map +0 -1
  267. package/build/esm/cron/common.js +0 -54
  268. package/build/esm/cron/common.js.map +0 -1
  269. package/build/esm/cron/cron.js +0 -110
  270. package/build/esm/cron/cron.js.map +0 -1
  271. package/build/esm/cron/index.js +0 -13
  272. package/build/esm/cron/index.js.map +0 -1
  273. package/build/esm/cron/node-cron.js +0 -69
  274. package/build/esm/cron/node-cron.js.map +0 -1
  275. package/build/esm/cron/node-schedule.js +0 -63
  276. package/build/esm/cron/node-schedule.js.map +0 -1
  277. package/build/esm/integrations/anr/index.js +0 -234
  278. package/build/esm/integrations/anr/index.js.map +0 -1
  279. package/build/esm/integrations/anr/worker-script.js +0 -2
  280. package/build/esm/integrations/childProcess.js +0 -98
  281. package/build/esm/integrations/childProcess.js.map +0 -1
  282. package/build/esm/integrations/context.js +0 -451
  283. package/build/esm/integrations/context.js.map +0 -1
  284. package/build/esm/integrations/contextlines.js +0 -399
  285. package/build/esm/integrations/contextlines.js.map +0 -1
  286. package/build/esm/integrations/http/SentryHttpInstrumentation.js +0 -555
  287. package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  288. package/build/esm/integrations/local-variables/common.js +0 -64
  289. package/build/esm/integrations/local-variables/common.js.map +0 -1
  290. package/build/esm/integrations/local-variables/index.js +0 -10
  291. package/build/esm/integrations/local-variables/index.js.map +0 -1
  292. package/build/esm/integrations/local-variables/local-variables-async.js +0 -140
  293. package/build/esm/integrations/local-variables/local-variables-async.js.map +0 -1
  294. package/build/esm/integrations/local-variables/local-variables-sync.js +0 -405
  295. package/build/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
  296. package/build/esm/integrations/local-variables/worker-script.js +0 -2
  297. package/build/esm/integrations/modules.js +0 -133
  298. package/build/esm/integrations/modules.js.map +0 -1
  299. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -289
  300. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  301. package/build/esm/integrations/onuncaughtexception.js +0 -131
  302. package/build/esm/integrations/onuncaughtexception.js.map +0 -1
  303. package/build/esm/integrations/onunhandledrejection.js +0 -86
  304. package/build/esm/integrations/onunhandledrejection.js.map +0 -1
  305. package/build/esm/integrations/processSession.js +0 -34
  306. package/build/esm/integrations/processSession.js.map +0 -1
  307. package/build/esm/integrations/spotlight.js +0 -98
  308. package/build/esm/integrations/spotlight.js.map +0 -1
  309. package/build/esm/integrations/winston.js +0 -149
  310. package/build/esm/integrations/winston.js.map +0 -1
  311. package/build/esm/logs/capture.js +0 -27
  312. package/build/esm/logs/capture.js.map +0 -1
  313. package/build/esm/logs/exports.js +0 -170
  314. package/build/esm/logs/exports.js.map +0 -1
  315. package/build/esm/nodeVersion.js +0 -8
  316. package/build/esm/nodeVersion.js.map +0 -1
  317. package/build/esm/otel/contextManager.js +0 -14
  318. package/build/esm/otel/contextManager.js.map +0 -1
  319. package/build/esm/otel/instrument.js +0 -135
  320. package/build/esm/otel/instrument.js.map +0 -1
  321. package/build/esm/proxy/base.js +0 -120
  322. package/build/esm/proxy/base.js.map +0 -1
  323. package/build/esm/proxy/index.js +0 -171
  324. package/build/esm/proxy/index.js.map +0 -1
  325. package/build/esm/proxy/parse-proxy-response.js +0 -102
  326. package/build/esm/proxy/parse-proxy-response.js.map +0 -1
  327. package/build/esm/sdk/api.js +0 -114
  328. package/build/esm/sdk/api.js.map +0 -1
  329. package/build/esm/sdk/client.js +0 -154
  330. package/build/esm/sdk/client.js.map +0 -1
  331. package/build/esm/transports/http.js +0 -156
  332. package/build/esm/transports/http.js.map +0 -1
  333. package/build/esm/utils/addOriginToSpan.js +0 -9
  334. package/build/esm/utils/addOriginToSpan.js.map +0 -1
  335. package/build/esm/utils/baggage.js +0 -34
  336. package/build/esm/utils/baggage.js.map +0 -1
  337. package/build/esm/utils/commonjs.js +0 -11
  338. package/build/esm/utils/commonjs.js.map +0 -1
  339. package/build/esm/utils/createMissingInstrumentationContext.js +0 -9
  340. package/build/esm/utils/createMissingInstrumentationContext.js.map +0 -1
  341. package/build/esm/utils/debug.js +0 -21
  342. package/build/esm/utils/debug.js.map +0 -1
  343. package/build/esm/utils/ensureIsWrapped.js +0 -39
  344. package/build/esm/utils/ensureIsWrapped.js.map +0 -1
  345. package/build/esm/utils/envToBool.js +0 -28
  346. package/build/esm/utils/envToBool.js.map +0 -1
  347. package/build/esm/utils/errorhandling.js +0 -40
  348. package/build/esm/utils/errorhandling.js.map +0 -1
  349. package/build/esm/utils/getRequestUrl.js +0 -16
  350. package/build/esm/utils/getRequestUrl.js.map +0 -1
  351. package/build/esm/utils/module.js +0 -58
  352. package/build/esm/utils/module.js.map +0 -1
  353. package/build/types/cron/common.d.ts +0 -5
  354. package/build/types/cron/common.d.ts.map +0 -1
  355. package/build/types/cron/cron.d.ts +0 -43
  356. package/build/types/cron/cron.d.ts.map +0 -1
  357. package/build/types/cron/index.d.ts +0 -10
  358. package/build/types/cron/index.d.ts.map +0 -1
  359. package/build/types/cron/node-cron.d.ts +0 -27
  360. package/build/types/cron/node-cron.d.ts.map +0 -1
  361. package/build/types/cron/node-schedule.d.ts +0 -19
  362. package/build/types/cron/node-schedule.d.ts.map +0 -1
  363. package/build/types/integrations/anr/common.d.ts +0 -52
  364. package/build/types/integrations/anr/common.d.ts.map +0 -1
  365. package/build/types/integrations/anr/index.d.ts +0 -13
  366. package/build/types/integrations/anr/index.d.ts.map +0 -1
  367. package/build/types/integrations/anr/worker.d.ts +0 -2
  368. package/build/types/integrations/anr/worker.d.ts.map +0 -1
  369. package/build/types/integrations/childProcess.d.ts +0 -20
  370. package/build/types/integrations/childProcess.d.ts.map +0 -1
  371. package/build/types/integrations/context.d.ts +0 -30
  372. package/build/types/integrations/context.d.ts.map +0 -1
  373. package/build/types/integrations/contextlines.d.ts +0 -31
  374. package/build/types/integrations/contextlines.d.ts.map +0 -1
  375. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +0 -131
  376. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +0 -1
  377. package/build/types/integrations/local-variables/common.d.ts +0 -66
  378. package/build/types/integrations/local-variables/common.d.ts.map +0 -1
  379. package/build/types/integrations/local-variables/index.d.ts +0 -4
  380. package/build/types/integrations/local-variables/index.d.ts.map +0 -1
  381. package/build/types/integrations/local-variables/local-variables-async.d.ts +0 -7
  382. package/build/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
  383. package/build/types/integrations/local-variables/local-variables-sync.d.ts +0 -34
  384. package/build/types/integrations/local-variables/local-variables-sync.d.ts.map +0 -1
  385. package/build/types/integrations/local-variables/worker.d.ts +0 -2
  386. package/build/types/integrations/local-variables/worker.d.ts.map +0 -1
  387. package/build/types/integrations/modules.d.ts +0 -17
  388. package/build/types/integrations/modules.d.ts.map +0 -1
  389. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  390. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts.map +0 -1
  391. package/build/types/integrations/onuncaughtexception.d.ts +0 -31
  392. package/build/types/integrations/onuncaughtexception.d.ts.map +0 -1
  393. package/build/types/integrations/onunhandledrejection.d.ts +0 -23
  394. package/build/types/integrations/onunhandledrejection.d.ts.map +0 -1
  395. package/build/types/integrations/processSession.d.ts +0 -5
  396. package/build/types/integrations/processSession.d.ts.map +0 -1
  397. package/build/types/integrations/spotlight.d.ts +0 -18
  398. package/build/types/integrations/spotlight.d.ts.map +0 -1
  399. package/build/types/integrations/winston.d.ts +0 -44
  400. package/build/types/integrations/winston.d.ts.map +0 -1
  401. package/build/types/logs/capture.d.ts +0 -11
  402. package/build/types/logs/capture.d.ts.map +0 -1
  403. package/build/types/logs/exports.d.ts +0 -150
  404. package/build/types/logs/exports.d.ts.map +0 -1
  405. package/build/types/nodeVersion.d.ts +0 -8
  406. package/build/types/nodeVersion.d.ts.map +0 -1
  407. package/build/types/otel/contextManager.d.ts +0 -10
  408. package/build/types/otel/contextManager.d.ts.map +0 -1
  409. package/build/types/otel/instrument.d.ts +0 -23
  410. package/build/types/otel/instrument.d.ts.map +0 -1
  411. package/build/types/proxy/base.d.ts +0 -65
  412. package/build/types/proxy/base.d.ts.map +0 -1
  413. package/build/types/proxy/helpers.d.ts +0 -42
  414. package/build/types/proxy/helpers.d.ts.map +0 -1
  415. package/build/types/proxy/index.d.ts +0 -73
  416. package/build/types/proxy/index.d.ts.map +0 -1
  417. package/build/types/proxy/parse-proxy-response.d.ts +0 -43
  418. package/build/types/proxy/parse-proxy-response.d.ts.map +0 -1
  419. package/build/types/sdk/api.d.ts +0 -8
  420. package/build/types/sdk/api.d.ts.map +0 -1
  421. package/build/types/sdk/client.d.ts +0 -29
  422. package/build/types/sdk/client.d.ts.map +0 -1
  423. package/build/types/sdk/scope.d.ts +0 -7
  424. package/build/types/sdk/scope.d.ts.map +0 -1
  425. package/build/types/transports/http-module.d.ts +0 -31
  426. package/build/types/transports/http-module.d.ts.map +0 -1
  427. package/build/types/transports/http.d.ts +0 -21
  428. package/build/types/transports/http.d.ts.map +0 -1
  429. package/build/types/transports/index.d.ts +0 -3
  430. package/build/types/transports/index.d.ts.map +0 -1
  431. package/build/types/utils/addOriginToSpan.d.ts +0 -5
  432. package/build/types/utils/addOriginToSpan.d.ts.map +0 -1
  433. package/build/types/utils/baggage.d.ts +0 -6
  434. package/build/types/utils/baggage.d.ts.map +0 -1
  435. package/build/types/utils/commonjs.d.ts +0 -3
  436. package/build/types/utils/commonjs.d.ts.map +0 -1
  437. package/build/types/utils/createMissingInstrumentationContext.d.ts +0 -3
  438. package/build/types/utils/createMissingInstrumentationContext.d.ts.map +0 -1
  439. package/build/types/utils/debug.d.ts +0 -5
  440. package/build/types/utils/debug.d.ts.map +0 -1
  441. package/build/types/utils/ensureIsWrapped.d.ts +0 -5
  442. package/build/types/utils/ensureIsWrapped.d.ts.map +0 -1
  443. package/build/types/utils/entry-point.d.ts +0 -24
  444. package/build/types/utils/entry-point.d.ts.map +0 -1
  445. package/build/types/utils/envToBool.d.ts +0 -13
  446. package/build/types/utils/envToBool.d.ts.map +0 -1
  447. package/build/types/utils/errorhandling.d.ts +0 -5
  448. package/build/types/utils/errorhandling.d.ts.map +0 -1
  449. package/build/types/utils/getRequestUrl.d.ts +0 -5
  450. package/build/types/utils/getRequestUrl.d.ts.map +0 -1
  451. package/build/types/utils/module.d.ts +0 -3
  452. package/build/types/utils/module.d.ts.map +0 -1
  453. package/build/types/utils/prepareEvent.d.ts +0 -17
  454. package/build/types/utils/prepareEvent.d.ts.map +0 -1
  455. package/build/types-ts3.8/cron/common.d.ts +0 -5
  456. package/build/types-ts3.8/cron/cron.d.ts +0 -43
  457. package/build/types-ts3.8/cron/index.d.ts +0 -10
  458. package/build/types-ts3.8/cron/node-cron.d.ts +0 -27
  459. package/build/types-ts3.8/cron/node-schedule.d.ts +0 -19
  460. package/build/types-ts3.8/integrations/anr/common.d.ts +0 -52
  461. package/build/types-ts3.8/integrations/anr/index.d.ts +0 -13
  462. package/build/types-ts3.8/integrations/anr/worker.d.ts +0 -2
  463. package/build/types-ts3.8/integrations/childProcess.d.ts +0 -20
  464. package/build/types-ts3.8/integrations/context.d.ts +0 -30
  465. package/build/types-ts3.8/integrations/contextlines.d.ts +0 -31
  466. package/build/types-ts3.8/integrations/http/SentryHttpInstrumentation.d.ts +0 -133
  467. package/build/types-ts3.8/integrations/local-variables/common.d.ts +0 -66
  468. package/build/types-ts3.8/integrations/local-variables/index.d.ts +0 -4
  469. package/build/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -7
  470. package/build/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +0 -34
  471. package/build/types-ts3.8/integrations/local-variables/worker.d.ts +0 -2
  472. package/build/types-ts3.8/integrations/modules.d.ts +0 -17
  473. package/build/types-ts3.8/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  474. package/build/types-ts3.8/integrations/onuncaughtexception.d.ts +0 -31
  475. package/build/types-ts3.8/integrations/onunhandledrejection.d.ts +0 -23
  476. package/build/types-ts3.8/integrations/processSession.d.ts +0 -5
  477. package/build/types-ts3.8/integrations/spotlight.d.ts +0 -18
  478. package/build/types-ts3.8/integrations/winston.d.ts +0 -44
  479. package/build/types-ts3.8/logs/capture.d.ts +0 -18
  480. package/build/types-ts3.8/logs/exports.d.ts +0 -150
  481. package/build/types-ts3.8/nodeVersion.d.ts +0 -8
  482. package/build/types-ts3.8/otel/contextManager.d.ts +0 -10
  483. package/build/types-ts3.8/otel/instrument.d.ts +0 -23
  484. package/build/types-ts3.8/proxy/base.d.ts +0 -60
  485. package/build/types-ts3.8/proxy/helpers.d.ts +0 -38
  486. package/build/types-ts3.8/proxy/index.d.ts +0 -74
  487. package/build/types-ts3.8/proxy/parse-proxy-response.d.ts +0 -40
  488. package/build/types-ts3.8/sdk/api.d.ts +0 -8
  489. package/build/types-ts3.8/sdk/client.d.ts +0 -32
  490. package/build/types-ts3.8/sdk/scope.d.ts +0 -7
  491. package/build/types-ts3.8/transports/http-module.d.ts +0 -28
  492. package/build/types-ts3.8/transports/http.d.ts +0 -20
  493. package/build/types-ts3.8/transports/index.d.ts +0 -3
  494. package/build/types-ts3.8/utils/addOriginToSpan.d.ts +0 -5
  495. package/build/types-ts3.8/utils/baggage.d.ts +0 -6
  496. package/build/types-ts3.8/utils/commonjs.d.ts +0 -3
  497. package/build/types-ts3.8/utils/createMissingInstrumentationContext.d.ts +0 -3
  498. package/build/types-ts3.8/utils/debug.d.ts +0 -5
  499. package/build/types-ts3.8/utils/ensureIsWrapped.d.ts +0 -5
  500. package/build/types-ts3.8/utils/entry-point.d.ts +0 -24
  501. package/build/types-ts3.8/utils/envToBool.d.ts +0 -13
  502. package/build/types-ts3.8/utils/errorhandling.d.ts +0 -5
  503. package/build/types-ts3.8/utils/getRequestUrl.d.ts +0 -5
  504. package/build/types-ts3.8/utils/module.d.ts +0 -3
  505. package/build/types-ts3.8/utils/prepareEvent.d.ts +0 -17
@@ -1,173 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const net = require('node:net');
4
- const tls = require('node:tls');
5
- const core = require('@sentry/core');
6
- const base = require('./base.js');
7
- const parseProxyResponse = require('./parse-proxy-response.js');
8
-
9
- function debug(...args) {
10
- core.logger.log('[https-proxy-agent]', ...args);
11
- }
12
-
13
- /**
14
- * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
15
- * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
16
- *
17
- * Outgoing HTTP requests are first tunneled through the proxy server using the
18
- * `CONNECT` HTTP request method to establish a connection to the proxy server,
19
- * and then the proxy server connects to the destination target and issues the
20
- * HTTP request from the proxy server.
21
- *
22
- * `https:` requests have their socket connection upgraded to TLS once
23
- * the connection to the proxy server has been established.
24
- */
25
- class HttpsProxyAgent extends base.Agent {
26
- static __initStatic() {this.protocols = ['http', 'https']; }
27
-
28
- constructor(proxy, opts) {
29
- super(opts);
30
- this.options = {};
31
- this.proxy = typeof proxy === 'string' ? new URL(proxy) : proxy;
32
- this.proxyHeaders = opts?.headers ?? {};
33
- debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
34
-
35
- // Trim off the brackets from IPv6 addresses
36
- const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
37
- const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === 'https:' ? 443 : 80;
38
- this.connectOpts = {
39
- // Attempt to negotiate http/1.1 for proxy servers that support http/2
40
- ALPNProtocols: ['http/1.1'],
41
- ...(opts ? omit(opts, 'headers') : null),
42
- host,
43
- port,
44
- };
45
- }
46
-
47
- /**
48
- * Called when the node-core HTTP client library is creating a
49
- * new HTTP request.
50
- */
51
- async connect(req, opts) {
52
- const { proxy } = this;
53
-
54
- if (!opts.host) {
55
- throw new TypeError('No "host" provided');
56
- }
57
-
58
- // Create a socket connection to the proxy server.
59
- let socket;
60
- if (proxy.protocol === 'https:') {
61
- debug('Creating `tls.Socket`: %o', this.connectOpts);
62
- const servername = this.connectOpts.servername || this.connectOpts.host;
63
- socket = tls.connect({
64
- ...this.connectOpts,
65
- servername: servername && net.isIP(servername) ? undefined : servername,
66
- });
67
- } else {
68
- debug('Creating `net.Socket`: %o', this.connectOpts);
69
- socket = net.connect(this.connectOpts);
70
- }
71
-
72
- const headers =
73
- typeof this.proxyHeaders === 'function' ? this.proxyHeaders() : { ...this.proxyHeaders };
74
- const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
75
- let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
76
-
77
- // Inject the `Proxy-Authorization` header if necessary.
78
- if (proxy.username || proxy.password) {
79
- const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
80
- headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;
81
- }
82
-
83
- headers.Host = `${host}:${opts.port}`;
84
-
85
- if (!headers['Proxy-Connection']) {
86
- headers['Proxy-Connection'] = this.keepAlive ? 'Keep-Alive' : 'close';
87
- }
88
- for (const name of Object.keys(headers)) {
89
- payload += `${name}: ${headers[name]}\r\n`;
90
- }
91
-
92
- const proxyResponsePromise = parseProxyResponse.parseProxyResponse(socket);
93
-
94
- socket.write(`${payload}\r\n`);
95
-
96
- const { connect, buffered } = await proxyResponsePromise;
97
- req.emit('proxyConnect', connect);
98
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
99
- // @ts-ignore Not EventEmitter in Node types
100
- this.emit('proxyConnect', connect, req);
101
-
102
- if (connect.statusCode === 200) {
103
- req.once('socket', resume);
104
-
105
- if (opts.secureEndpoint) {
106
- // The proxy is connecting to a TLS server, so upgrade
107
- // this socket connection to a TLS connection.
108
- debug('Upgrading socket connection to TLS');
109
- const servername = opts.servername || opts.host;
110
- return tls.connect({
111
- ...omit(opts, 'host', 'path', 'port'),
112
- socket,
113
- servername: net.isIP(servername) ? undefined : servername,
114
- });
115
- }
116
-
117
- return socket;
118
- }
119
-
120
- // Some other status code that's not 200... need to re-play the HTTP
121
- // header "data" events onto the socket once the HTTP machinery is
122
- // attached so that the node core `http` can parse and handle the
123
- // error status code.
124
-
125
- // Close the original socket, and a new "fake" socket is returned
126
- // instead, so that the proxy doesn't get the HTTP request
127
- // written to it (which may contain `Authorization` headers or other
128
- // sensitive data).
129
- //
130
- // See: https://hackerone.com/reports/541502
131
- socket.destroy();
132
-
133
- const fakeSocket = new net.Socket({ writable: false });
134
- fakeSocket.readable = true;
135
-
136
- // Need to wait for the "socket" event to re-play the "data" events.
137
- req.once('socket', (s) => {
138
- debug('Replaying proxy buffer for failed request');
139
- // Replay the "buffered" Buffer onto the fake `socket`, since at
140
- // this point the HTTP module machinery has been hooked up for
141
- // the user.
142
- s.push(buffered);
143
- s.push(null);
144
- });
145
-
146
- return fakeSocket;
147
- }
148
- } HttpsProxyAgent.__initStatic();
149
-
150
- function resume(socket) {
151
- socket.resume();
152
- }
153
-
154
- function omit(
155
- obj,
156
- ...keys
157
- )
158
-
159
- {
160
- const ret = {}
161
-
162
- ;
163
- let key;
164
- for (key in obj) {
165
- if (!keys.includes(key)) {
166
- ret[key] = obj[key];
167
- }
168
- }
169
- return ret;
170
- }
171
-
172
- exports.HttpsProxyAgent = HttpsProxyAgent;
173
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/proxy/index.ts"],"sourcesContent":["/**\n * This code was originally forked from https://github.com/TooTallNate/proxy-agents/tree/b133295fd16f6475578b6b15bd9b4e33ecb0d0b7\n * With the following LICENSE:\n *\n * (The MIT License)\n *\n * Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>*\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * 'Software'), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:*\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.*\n *\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* eslint-disable @typescript-eslint/explicit-member-accessibility */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type * as http from 'node:http';\nimport type { OutgoingHttpHeaders } from 'node:http';\nimport * as net from 'node:net';\nimport * as tls from 'node:tls';\nimport { logger } from '@sentry/core';\nimport type { AgentConnectOpts } from './base';\nimport { Agent } from './base';\nimport { parseProxyResponse } from './parse-proxy-response';\n\nfunction debug(...args: unknown[]): void {\n logger.log('[https-proxy-agent]', ...args);\n}\n\ntype Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;\n\ntype ConnectOptsMap = {\n http: Omit<net.TcpNetConnectOpts, 'host' | 'port'>;\n https: Omit<tls.ConnectionOptions, 'host' | 'port'>;\n};\n\ntype ConnectOpts<T> = {\n [P in keyof ConnectOptsMap]: Protocol<T> extends P ? ConnectOptsMap[P] : never;\n}[keyof ConnectOptsMap];\n\nexport type HttpsProxyAgentOptions<T> = ConnectOpts<T> &\n http.AgentOptions & {\n headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);\n };\n\n/**\n * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to\n * the specified \"HTTP(s) proxy server\" in order to proxy HTTPS requests.\n *\n * Outgoing HTTP requests are first tunneled through the proxy server using the\n * `CONNECT` HTTP request method to establish a connection to the proxy server,\n * and then the proxy server connects to the destination target and issues the\n * HTTP request from the proxy server.\n *\n * `https:` requests have their socket connection upgraded to TLS once\n * the connection to the proxy server has been established.\n */\nexport class HttpsProxyAgent<Uri extends string> extends Agent {\n static protocols = ['http', 'https'] as const;\n\n readonly proxy: URL;\n proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);\n connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;\n\n constructor(proxy: Uri | URL, opts?: HttpsProxyAgentOptions<Uri>) {\n super(opts);\n this.options = {};\n this.proxy = typeof proxy === 'string' ? new URL(proxy) : proxy;\n this.proxyHeaders = opts?.headers ?? {};\n debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);\n\n // Trim off the brackets from IPv6 addresses\n const host = (this.proxy.hostname || this.proxy.host).replace(/^\\[|\\]$/g, '');\n const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === 'https:' ? 443 : 80;\n this.connectOpts = {\n // Attempt to negotiate http/1.1 for proxy servers that support http/2\n ALPNProtocols: ['http/1.1'],\n ...(opts ? omit(opts, 'headers') : null),\n host,\n port,\n };\n }\n\n /**\n * Called when the node-core HTTP client library is creating a\n * new HTTP request.\n */\n async connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<net.Socket> {\n const { proxy } = this;\n\n if (!opts.host) {\n throw new TypeError('No \"host\" provided');\n }\n\n // Create a socket connection to the proxy server.\n let socket: net.Socket;\n if (proxy.protocol === 'https:') {\n debug('Creating `tls.Socket`: %o', this.connectOpts);\n const servername = this.connectOpts.servername || this.connectOpts.host;\n socket = tls.connect({\n ...this.connectOpts,\n servername: servername && net.isIP(servername) ? undefined : servername,\n });\n } else {\n debug('Creating `net.Socket`: %o', this.connectOpts);\n socket = net.connect(this.connectOpts);\n }\n\n const headers: OutgoingHttpHeaders =\n typeof this.proxyHeaders === 'function' ? this.proxyHeaders() : { ...this.proxyHeaders };\n const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;\n let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\\r\\n`;\n\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.username || proxy.password) {\n const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;\n headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;\n }\n\n headers.Host = `${host}:${opts.port}`;\n\n if (!headers['Proxy-Connection']) {\n headers['Proxy-Connection'] = this.keepAlive ? 'Keep-Alive' : 'close';\n }\n for (const name of Object.keys(headers)) {\n payload += `${name}: ${headers[name]}\\r\\n`;\n }\n\n const proxyResponsePromise = parseProxyResponse(socket);\n\n socket.write(`${payload}\\r\\n`);\n\n const { connect, buffered } = await proxyResponsePromise;\n req.emit('proxyConnect', connect);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Not EventEmitter in Node types\n this.emit('proxyConnect', connect, req);\n\n if (connect.statusCode === 200) {\n req.once('socket', resume);\n\n if (opts.secureEndpoint) {\n // The proxy is connecting to a TLS server, so upgrade\n // this socket connection to a TLS connection.\n debug('Upgrading socket connection to TLS');\n const servername = opts.servername || opts.host;\n return tls.connect({\n ...omit(opts, 'host', 'path', 'port'),\n socket,\n servername: net.isIP(servername) ? undefined : servername,\n });\n }\n\n return socket;\n }\n\n // Some other status code that's not 200... need to re-play the HTTP\n // header \"data\" events onto the socket once the HTTP machinery is\n // attached so that the node core `http` can parse and handle the\n // error status code.\n\n // Close the original socket, and a new \"fake\" socket is returned\n // instead, so that the proxy doesn't get the HTTP request\n // written to it (which may contain `Authorization` headers or other\n // sensitive data).\n //\n // See: https://hackerone.com/reports/541502\n socket.destroy();\n\n const fakeSocket = new net.Socket({ writable: false });\n fakeSocket.readable = true;\n\n // Need to wait for the \"socket\" event to re-play the \"data\" events.\n req.once('socket', (s: net.Socket) => {\n debug('Replaying proxy buffer for failed request');\n // Replay the \"buffered\" Buffer onto the fake `socket`, since at\n // this point the HTTP module machinery has been hooked up for\n // the user.\n s.push(buffered);\n s.push(null);\n });\n\n return fakeSocket;\n }\n}\n\nfunction resume(socket: net.Socket | tls.TLSSocket): void {\n socket.resume();\n}\n\nfunction omit<T extends object, K extends [...(keyof T)[]]>(\n obj: T,\n ...keys: K\n): {\n [K2 in Exclude<keyof T, K[number]>]: T[K2];\n} {\n const ret = {} as {\n [K in keyof typeof obj]: (typeof obj)[K];\n };\n let key: keyof typeof obj;\n for (key in obj) {\n if (!keys.includes(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n}\n"],"names":["logger","Agent","parseProxyResponse"],"mappings":";;;;;;;;AAuCA,SAAS,KAAK,CAAC,GAAG,IAAI,EAAmB;AACzC,EAAEA,WAAM,CAAC,GAAG,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC;AAC5C;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,eAAA,SAAAC,UAAA,CAAA;AACA,EAAA,OAAA,YAAA,GAAA,CAAA,IAAA,CAAA,SAAA,GAAA,CAAA,MAAA,EAAA,OAAA,EAAA;;AAMA,EAAA,WAAA,CAAA,KAAA,EAAA,IAAA,EAAA;AACA,IAAA,KAAA,CAAA,IAAA,CAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,EAAA;AACA,IAAA,IAAA,CAAA,KAAA,GAAA,OAAA,KAAA,KAAA,QAAA,GAAA,IAAA,GAAA,CAAA,KAAA,CAAA,GAAA,KAAA;AACA,IAAA,IAAA,CAAA,YAAA,GAAA,IAAA,EAAA,OAAA,IAAA,EAAA;AACA,IAAA,KAAA,CAAA,2CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA;;AAEA;AACA,IAAA,MAAA,IAAA,GAAA,CAAA,IAAA,CAAA,KAAA,CAAA,QAAA,IAAA,IAAA,CAAA,KAAA,CAAA,IAAA,EAAA,OAAA,CAAA,UAAA,EAAA,EAAA,CAAA;AACA,IAAA,MAAA,IAAA,GAAA,IAAA,CAAA,KAAA,CAAA,IAAA,GAAA,QAAA,CAAA,IAAA,CAAA,KAAA,CAAA,IAAA,EAAA,EAAA,CAAA,GAAA,IAAA,CAAA,KAAA,CAAA,QAAA,KAAA,QAAA,GA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AAA,EAAA;AACA,EAAA,MAAA,CAAA,MAAA,EAAA;AACA;;AAEA,SAAA,IAAA;AACA,EAAA,GAAA;AACA,EAAA,GAAA;AACA;;AAEA,CAAA;AACA,EAAA,MAAA,GAAA,GAAA;;AAEA;AACA,EAAA,IAAA,GAAA;AACA,EAAA,KAAA,GAAA,IAAA,GAAA,EAAA;AACA,IAAA,IAAA,CAAA,IAAA,CAAA,QAAA,CAAA,GAAA,CAAA,EAAA;AACA,MAAA,GAAA,CAAA,GAAA,CAAA,GAAA,GAAA,CAAA,GAAA,CAAA;AACA;AACA;AACA,EAAA,OAAA,GAAA;AACA;;;;"}
@@ -1,104 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
-
5
- function debug(...args) {
6
- core.logger.log('[https-proxy-agent:parse-proxy-response]', ...args);
7
- }
8
-
9
- function parseProxyResponse(socket) {
10
- return new Promise((resolve, reject) => {
11
- // we need to buffer any HTTP traffic that happens with the proxy before we get
12
- // the CONNECT response, so that if the response is anything other than an "200"
13
- // response code, then we can re-play the "data" events on the socket once the
14
- // HTTP parser is hooked up...
15
- let buffersLength = 0;
16
- const buffers = [];
17
-
18
- function read() {
19
- const b = socket.read();
20
- if (b) ondata(b);
21
- else socket.once('readable', read);
22
- }
23
-
24
- function cleanup() {
25
- socket.removeListener('end', onend);
26
- socket.removeListener('error', onerror);
27
- socket.removeListener('readable', read);
28
- }
29
-
30
- function onend() {
31
- cleanup();
32
- debug('onend');
33
- reject(new Error('Proxy connection ended before receiving CONNECT response'));
34
- }
35
-
36
- function onerror(err) {
37
- cleanup();
38
- debug('onerror %o', err);
39
- reject(err);
40
- }
41
-
42
- function ondata(b) {
43
- buffers.push(b);
44
- buffersLength += b.length;
45
-
46
- const buffered = Buffer.concat(buffers, buffersLength);
47
- const endOfHeaders = buffered.indexOf('\r\n\r\n');
48
-
49
- if (endOfHeaders === -1) {
50
- // keep buffering
51
- debug('have not received end of HTTP headers yet...');
52
- read();
53
- return;
54
- }
55
-
56
- const headerParts = buffered.subarray(0, endOfHeaders).toString('ascii').split('\r\n');
57
- const firstLine = headerParts.shift();
58
- if (!firstLine) {
59
- socket.destroy();
60
- return reject(new Error('No header received from proxy CONNECT response'));
61
- }
62
- const firstLineParts = firstLine.split(' ');
63
- const statusCode = +(firstLineParts[1] || 0);
64
- const statusText = firstLineParts.slice(2).join(' ');
65
- const headers = {};
66
- for (const header of headerParts) {
67
- if (!header) continue;
68
- const firstColon = header.indexOf(':');
69
- if (firstColon === -1) {
70
- socket.destroy();
71
- return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
72
- }
73
- const key = header.slice(0, firstColon).toLowerCase();
74
- const value = header.slice(firstColon + 1).trimStart();
75
- const current = headers[key];
76
- if (typeof current === 'string') {
77
- headers[key] = [current, value];
78
- } else if (Array.isArray(current)) {
79
- current.push(value);
80
- } else {
81
- headers[key] = value;
82
- }
83
- }
84
- debug('got proxy server response: %o %o', firstLine, headers);
85
- cleanup();
86
- resolve({
87
- connect: {
88
- statusCode,
89
- statusText,
90
- headers,
91
- },
92
- buffered,
93
- });
94
- }
95
-
96
- socket.on('error', onerror);
97
- socket.on('end', onend);
98
-
99
- read();
100
- });
101
- }
102
-
103
- exports.parseProxyResponse = parseProxyResponse;
104
- //# sourceMappingURL=parse-proxy-response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-proxy-response.js","sources":["../../../src/proxy/parse-proxy-response.ts"],"sourcesContent":["/**\n * This code was originally forked from https://github.com/TooTallNate/proxy-agents/tree/b133295fd16f6475578b6b15bd9b4e33ecb0d0b7\n * With the following LICENSE:\n *\n * (The MIT License)\n *\n * Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>*\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * 'Software'), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:*\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.*\n *\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable jsdoc/require-jsdoc */\nimport type { IncomingHttpHeaders } from 'node:http';\nimport type { Readable } from 'node:stream';\nimport { logger } from '@sentry/core';\n\nfunction debug(...args: unknown[]): void {\n logger.log('[https-proxy-agent:parse-proxy-response]', ...args);\n}\n\nexport interface ConnectResponse {\n statusCode: number;\n statusText: string;\n headers: IncomingHttpHeaders;\n}\n\nexport function parseProxyResponse(socket: Readable): Promise<{ connect: ConnectResponse; buffered: Buffer }> {\n return new Promise((resolve, reject) => {\n // we need to buffer any HTTP traffic that happens with the proxy before we get\n // the CONNECT response, so that if the response is anything other than an \"200\"\n // response code, then we can re-play the \"data\" events on the socket once the\n // HTTP parser is hooked up...\n let buffersLength = 0;\n const buffers: Buffer[] = [];\n\n function read() {\n const b = socket.read();\n if (b) ondata(b);\n else socket.once('readable', read);\n }\n\n function cleanup() {\n socket.removeListener('end', onend);\n socket.removeListener('error', onerror);\n socket.removeListener('readable', read);\n }\n\n function onend() {\n cleanup();\n debug('onend');\n reject(new Error('Proxy connection ended before receiving CONNECT response'));\n }\n\n function onerror(err: Error) {\n cleanup();\n debug('onerror %o', err);\n reject(err);\n }\n\n function ondata(b: Buffer) {\n buffers.push(b);\n buffersLength += b.length;\n\n const buffered = Buffer.concat(buffers, buffersLength);\n const endOfHeaders = buffered.indexOf('\\r\\n\\r\\n');\n\n if (endOfHeaders === -1) {\n // keep buffering\n debug('have not received end of HTTP headers yet...');\n read();\n return;\n }\n\n const headerParts = buffered.subarray(0, endOfHeaders).toString('ascii').split('\\r\\n');\n const firstLine = headerParts.shift();\n if (!firstLine) {\n socket.destroy();\n return reject(new Error('No header received from proxy CONNECT response'));\n }\n const firstLineParts = firstLine.split(' ');\n const statusCode = +(firstLineParts[1] || 0);\n const statusText = firstLineParts.slice(2).join(' ');\n const headers: IncomingHttpHeaders = {};\n for (const header of headerParts) {\n if (!header) continue;\n const firstColon = header.indexOf(':');\n if (firstColon === -1) {\n socket.destroy();\n return reject(new Error(`Invalid header from proxy CONNECT response: \"${header}\"`));\n }\n const key = header.slice(0, firstColon).toLowerCase();\n const value = header.slice(firstColon + 1).trimStart();\n const current = headers[key];\n if (typeof current === 'string') {\n headers[key] = [current, value];\n } else if (Array.isArray(current)) {\n current.push(value);\n } else {\n headers[key] = value;\n }\n }\n debug('got proxy server response: %o %o', firstLine, headers);\n cleanup();\n resolve({\n connect: {\n statusCode,\n statusText,\n headers,\n },\n buffered,\n });\n }\n\n socket.on('error', onerror);\n socket.on('end', onend);\n\n read();\n });\n}\n"],"names":["logger"],"mappings":";;;;AAkCA,SAAS,KAAK,CAAC,GAAG,IAAI,EAAmB;AACzC,EAAEA,WAAM,CAAC,GAAG,CAAC,0CAA0C,EAAE,GAAG,IAAI,CAAC;AACjE;;AAQO,SAAS,kBAAkB,CAAC,MAAM,EAAqE;AAC9G,EAAE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC1C;AACA;AACA;AACA;AACA,IAAI,IAAI,aAAc,GAAE,CAAC;AACzB,IAAI,MAAM,OAAO,GAAa,EAAE;;AAEhC,IAAI,SAAS,IAAI,GAAG;A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zC,SAAQ,MAAO,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;AAC3C,UAAU,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC7B,eAAe;AACf,UAAU,OAAO,CAAC,GAAG,CAAA,GAAI,KAAK;AAC9B;AACA;AACA,MAAM,KAAK,CAAC,kCAAkC,EAAE,SAAS,EAAE,OAAO,CAAC;AACnE,MAAM,OAAO,EAAE;AACf,MAAM,OAAO,CAAC;AACd,QAAQ,OAAO,EAAE;AACjB,UAAU,UAAU;AACpB,UAAU,UAAU;AACpB,UAAU,OAAO;AACjB,SAAS;AACT,QAAQ,QAAQ;AAChB,OAAO,CAAC;AACR;;AAEA,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAC/B,IAAI,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;;AAE3B,IAAI,IAAI,EAAE;AACV,GAAG,CAAC;AACJ;;;;"}
@@ -1,117 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const module$1 = require('../utils/module.js');
5
-
6
- /**
7
- * Returns a release dynamically from environment variables.
8
- */
9
- // eslint-disable-next-line complexity
10
- function getSentryRelease(fallback) {
11
- // Always read first as Sentry takes this as precedence
12
- if (process.env.SENTRY_RELEASE) {
13
- return process.env.SENTRY_RELEASE;
14
- }
15
-
16
- // This supports the variable that sentry-webpack-plugin injects
17
- if (core.GLOBAL_OBJ.SENTRY_RELEASE?.id) {
18
- return core.GLOBAL_OBJ.SENTRY_RELEASE.id;
19
- }
20
-
21
- // This list is in approximate alpha order, separated into 3 categories:
22
- // 1. Git providers
23
- // 2. CI providers with specific environment variables (has the provider name in the variable name)
24
- // 3. CI providers with generic environment variables (checked for last to prevent possible false positives)
25
-
26
- const possibleReleaseNameOfGitProvider =
27
- // GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
28
- process.env['GITHUB_SHA'] ||
29
- // GitLab CI - https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
30
- process.env['CI_MERGE_REQUEST_SOURCE_BRANCH_SHA'] ||
31
- process.env['CI_BUILD_REF'] ||
32
- process.env['CI_COMMIT_SHA'] ||
33
- // Bitbucket - https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/
34
- process.env['BITBUCKET_COMMIT'];
35
-
36
- const possibleReleaseNameOfCiProvidersWithSpecificEnvVar =
37
- // AppVeyor - https://www.appveyor.com/docs/environment-variables/
38
- process.env['APPVEYOR_PULL_REQUEST_HEAD_COMMIT'] ||
39
- process.env['APPVEYOR_REPO_COMMIT'] ||
40
- // AWS CodeBuild - https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
41
- process.env['CODEBUILD_RESOLVED_SOURCE_VERSION'] ||
42
- // AWS Amplify - https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html
43
- process.env['AWS_COMMIT_ID'] ||
44
- // Azure Pipelines - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
45
- process.env['BUILD_SOURCEVERSION'] ||
46
- // Bitrise - https://devcenter.bitrise.io/builds/available-environment-variables/
47
- process.env['GIT_CLONE_COMMIT_HASH'] ||
48
- // Buddy CI - https://buddy.works/docs/pipelines/environment-variables#default-environment-variables
49
- process.env['BUDDY_EXECUTION_REVISION'] ||
50
- // Builtkite - https://buildkite.com/docs/pipelines/environment-variables
51
- process.env['BUILDKITE_COMMIT'] ||
52
- // CircleCI - https://circleci.com/docs/variables/
53
- process.env['CIRCLE_SHA1'] ||
54
- // Cirrus CI - https://cirrus-ci.org/guide/writing-tasks/#environment-variables
55
- process.env['CIRRUS_CHANGE_IN_REPO'] ||
56
- // Codefresh - https://codefresh.io/docs/docs/codefresh-yaml/variables/
57
- process.env['CF_REVISION'] ||
58
- // Codemagic - https://docs.codemagic.io/yaml-basic-configuration/environment-variables/
59
- process.env['CM_COMMIT'] ||
60
- // Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables
61
- process.env['CF_PAGES_COMMIT_SHA'] ||
62
- // Drone - https://docs.drone.io/pipeline/environment/reference/
63
- process.env['DRONE_COMMIT_SHA'] ||
64
- // Flightcontrol - https://www.flightcontrol.dev/docs/guides/flightcontrol/environment-variables#built-in-environment-variables
65
- process.env['FC_GIT_COMMIT_SHA'] ||
66
- // Heroku #1 https://devcenter.heroku.com/articles/heroku-ci
67
- process.env['HEROKU_TEST_RUN_COMMIT_VERSION'] ||
68
- // Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases
69
- process.env['HEROKU_SLUG_COMMIT'] ||
70
- // Railway - https://docs.railway.app/reference/variables#git-variables
71
- process.env['RAILWAY_GIT_COMMIT_SHA'] ||
72
- // Render - https://render.com/docs/environment-variables
73
- process.env['RENDER_GIT_COMMIT'] ||
74
- // Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables
75
- process.env['SEMAPHORE_GIT_SHA'] ||
76
- // TravisCI - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
77
- process.env['TRAVIS_PULL_REQUEST_SHA'] ||
78
- // Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables
79
- process.env['VERCEL_GIT_COMMIT_SHA'] ||
80
- process.env['VERCEL_GITHUB_COMMIT_SHA'] ||
81
- process.env['VERCEL_GITLAB_COMMIT_SHA'] ||
82
- process.env['VERCEL_BITBUCKET_COMMIT_SHA'] ||
83
- // Zeit (now known as Vercel)
84
- process.env['ZEIT_GITHUB_COMMIT_SHA'] ||
85
- process.env['ZEIT_GITLAB_COMMIT_SHA'] ||
86
- process.env['ZEIT_BITBUCKET_COMMIT_SHA'];
87
-
88
- const possibleReleaseNameOfCiProvidersWithGenericEnvVar =
89
- // CloudBees CodeShip - https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables
90
- process.env['CI_COMMIT_ID'] ||
91
- // Coolify - https://coolify.io/docs/knowledge-base/environment-variables
92
- process.env['SOURCE_COMMIT'] ||
93
- // Heroku #3 https://devcenter.heroku.com/changelog-items/630
94
- process.env['SOURCE_VERSION'] ||
95
- // Jenkins - https://plugins.jenkins.io/git/#environment-variables
96
- process.env['GIT_COMMIT'] ||
97
- // Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
98
- process.env['COMMIT_REF'] ||
99
- // TeamCity - https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html
100
- process.env['BUILD_VCS_NUMBER'] ||
101
- // Woodpecker CI - https://woodpecker-ci.org/docs/usage/environment
102
- process.env['CI_COMMIT_SHA'];
103
-
104
- return (
105
- possibleReleaseNameOfGitProvider ||
106
- possibleReleaseNameOfCiProvidersWithSpecificEnvVar ||
107
- possibleReleaseNameOfCiProvidersWithGenericEnvVar ||
108
- fallback
109
- );
110
- }
111
-
112
- /** Node.js stack parser */
113
- const defaultStackParser = core.createStackParser(core.nodeStackLineParser(module$1.createGetModuleFromFilename()));
114
-
115
- exports.defaultStackParser = defaultStackParser;
116
- exports.getSentryRelease = getSentryRelease;
117
- //# sourceMappingURL=api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sources":["../../../src/sdk/api.ts"],"sourcesContent":["// PUBLIC APIS\n\nimport type { StackParser } from '@sentry/core';\nimport { createStackParser, GLOBAL_OBJ, nodeStackLineParser } from '@sentry/core';\nimport { createGetModuleFromFilename } from '../utils/module';\n\n/**\n * Returns a release dynamically from environment variables.\n */\n// eslint-disable-next-line complexity\nexport function getSentryRelease(fallback?: string): string | undefined {\n // Always read first as Sentry takes this as precedence\n if (process.env.SENTRY_RELEASE) {\n return process.env.SENTRY_RELEASE;\n }\n\n // This supports the variable that sentry-webpack-plugin injects\n if (GLOBAL_OBJ.SENTRY_RELEASE?.id) {\n return GLOBAL_OBJ.SENTRY_RELEASE.id;\n }\n\n // This list is in approximate alpha order, separated into 3 categories:\n // 1. Git providers\n // 2. CI providers with specific environment variables (has the provider name in the variable name)\n // 3. CI providers with generic environment variables (checked for last to prevent possible false positives)\n\n const possibleReleaseNameOfGitProvider =\n // GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables\n process.env['GITHUB_SHA'] ||\n // GitLab CI - https://docs.gitlab.com/ee/ci/variables/predefined_variables.html\n process.env['CI_MERGE_REQUEST_SOURCE_BRANCH_SHA'] ||\n process.env['CI_BUILD_REF'] ||\n process.env['CI_COMMIT_SHA'] ||\n // Bitbucket - https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/\n process.env['BITBUCKET_COMMIT'];\n\n const possibleReleaseNameOfCiProvidersWithSpecificEnvVar =\n // AppVeyor - https://www.appveyor.com/docs/environment-variables/\n process.env['APPVEYOR_PULL_REQUEST_HEAD_COMMIT'] ||\n process.env['APPVEYOR_REPO_COMMIT'] ||\n // AWS CodeBuild - https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html\n process.env['CODEBUILD_RESOLVED_SOURCE_VERSION'] ||\n // AWS Amplify - https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html\n process.env['AWS_COMMIT_ID'] ||\n // Azure Pipelines - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml\n process.env['BUILD_SOURCEVERSION'] ||\n // Bitrise - https://devcenter.bitrise.io/builds/available-environment-variables/\n process.env['GIT_CLONE_COMMIT_HASH'] ||\n // Buddy CI - https://buddy.works/docs/pipelines/environment-variables#default-environment-variables\n process.env['BUDDY_EXECUTION_REVISION'] ||\n // Builtkite - https://buildkite.com/docs/pipelines/environment-variables\n process.env['BUILDKITE_COMMIT'] ||\n // CircleCI - https://circleci.com/docs/variables/\n process.env['CIRCLE_SHA1'] ||\n // Cirrus CI - https://cirrus-ci.org/guide/writing-tasks/#environment-variables\n process.env['CIRRUS_CHANGE_IN_REPO'] ||\n // Codefresh - https://codefresh.io/docs/docs/codefresh-yaml/variables/\n process.env['CF_REVISION'] ||\n // Codemagic - https://docs.codemagic.io/yaml-basic-configuration/environment-variables/\n process.env['CM_COMMIT'] ||\n // Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables\n process.env['CF_PAGES_COMMIT_SHA'] ||\n // Drone - https://docs.drone.io/pipeline/environment/reference/\n process.env['DRONE_COMMIT_SHA'] ||\n // Flightcontrol - https://www.flightcontrol.dev/docs/guides/flightcontrol/environment-variables#built-in-environment-variables\n process.env['FC_GIT_COMMIT_SHA'] ||\n // Heroku #1 https://devcenter.heroku.com/articles/heroku-ci\n process.env['HEROKU_TEST_RUN_COMMIT_VERSION'] ||\n // Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases\n process.env['HEROKU_SLUG_COMMIT'] ||\n // Railway - https://docs.railway.app/reference/variables#git-variables\n process.env['RAILWAY_GIT_COMMIT_SHA'] ||\n // Render - https://render.com/docs/environment-variables\n process.env['RENDER_GIT_COMMIT'] ||\n // Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables\n process.env['SEMAPHORE_GIT_SHA'] ||\n // TravisCI - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables\n process.env['TRAVIS_PULL_REQUEST_SHA'] ||\n // Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables\n process.env['VERCEL_GIT_COMMIT_SHA'] ||\n process.env['VERCEL_GITHUB_COMMIT_SHA'] ||\n process.env['VERCEL_GITLAB_COMMIT_SHA'] ||\n process.env['VERCEL_BITBUCKET_COMMIT_SHA'] ||\n // Zeit (now known as Vercel)\n process.env['ZEIT_GITHUB_COMMIT_SHA'] ||\n process.env['ZEIT_GITLAB_COMMIT_SHA'] ||\n process.env['ZEIT_BITBUCKET_COMMIT_SHA'];\n\n const possibleReleaseNameOfCiProvidersWithGenericEnvVar =\n // CloudBees CodeShip - https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables\n process.env['CI_COMMIT_ID'] ||\n // Coolify - https://coolify.io/docs/knowledge-base/environment-variables\n process.env['SOURCE_COMMIT'] ||\n // Heroku #3 https://devcenter.heroku.com/changelog-items/630\n process.env['SOURCE_VERSION'] ||\n // Jenkins - https://plugins.jenkins.io/git/#environment-variables\n process.env['GIT_COMMIT'] ||\n // Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n process.env['COMMIT_REF'] ||\n // TeamCity - https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html\n process.env['BUILD_VCS_NUMBER'] ||\n // Woodpecker CI - https://woodpecker-ci.org/docs/usage/environment\n process.env['CI_COMMIT_SHA'];\n\n return (\n possibleReleaseNameOfGitProvider ||\n possibleReleaseNameOfCiProvidersWithSpecificEnvVar ||\n possibleReleaseNameOfCiProvidersWithGenericEnvVar ||\n fallback\n );\n}\n\n/** Node.js stack parser */\nexport const defaultStackParser: StackParser = createStackParser(nodeStackLineParser(createGetModuleFromFilename()));\n"],"names":["GLOBAL_OBJ","createStackParser","nodeStackLineParser","createGetModuleFromFilename"],"mappings":";;;;;AAMA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,QAAQ,EAA+B;AACxE;AACA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;AAClC,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc;AACrC;;AAEA;AACA,EAAE,IAAIA,eAAU,CAAC,cAAc,EAAE,EAAE,EAAE;AACrC,IAAI,OAAOA,eAAU,CAAC,cAAc,CAAC,EAAE;AACvC;;AAEA;AACA;AACA;AACA;;AAEA,EAAE,MAAM,gCAAiC;AACzC;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAE;AAC9B;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAE;AACtD,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAE;AAChC,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAE;AACjC;AACA,IAAI,OAAO,CAAC,GAAG,CA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GAAG,CAAC,uBAAuB,CAAE;AACzC,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAE;AAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAE;AAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAE;AAC/C;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAE;AAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAE;AAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;;AAE5C,EAAE,MAAM,iDAAkD;AAC1D;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAE;AAChC;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAE;AACjC;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAE;AAClC;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAE;AAC9B;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAE;AAC9B;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAE;AACpC;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;;AAEhC,EAAE;AACF,IAAI,gCAAiC;AACrC,IAAI,kDAAmD;AACvD,IAAI,iDAAkD;AACtD,IAAI;AACJ;AACA;;AAEA;AACa,MAAA,kBAAkB,GAAgBC,sBAAiB,CAACC,wBAAmB,CAACC,oCAA2B,EAAE,CAAC;;;;;"}
@@ -1,156 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const os = require('node:os');
4
- const api = require('@opentelemetry/api');
5
- const instrumentation = require('@opentelemetry/instrumentation');
6
- const core = require('@sentry/core');
7
- const opentelemetry = require('@sentry/opentelemetry');
8
- const worker_threads = require('worker_threads');
9
- const debugBuild = require('../debug-build.js');
10
-
11
- const DEFAULT_CLIENT_REPORT_FLUSH_INTERVAL_MS = 60000; // 60s was chosen arbitrarily
12
-
13
- /** A client for using Sentry with Node & OpenTelemetry. */
14
- class NodeClient extends core.ServerRuntimeClient {
15
-
16
- constructor(options) {
17
- const serverName =
18
- options.includeServerName === false
19
- ? undefined
20
- : options.serverName || global.process.env.SENTRY_NAME || os.hostname();
21
-
22
- const clientOptions = {
23
- ...options,
24
- platform: 'node',
25
- runtime: { name: 'node', version: global.process.version },
26
- serverName,
27
- };
28
-
29
- if (options.openTelemetryInstrumentations) {
30
- instrumentation.registerInstrumentations({
31
- instrumentations: options.openTelemetryInstrumentations,
32
- });
33
- }
34
-
35
- core.applySdkMetadata(clientOptions, 'node');
36
-
37
- core.logger.log(
38
- `Initializing Sentry: process: ${process.pid}, thread: ${worker_threads.isMainThread ? 'main' : `worker-${worker_threads.threadId}`}.`,
39
- );
40
-
41
- super(clientOptions);
42
-
43
- if (this.getOptions()._experiments?.enableLogs) {
44
- this._logOnExitFlushListener = () => {
45
- core._INTERNAL_flushLogsBuffer(this);
46
- };
47
-
48
- if (serverName) {
49
- this.on('beforeCaptureLog', log => {
50
- log.attributes = {
51
- ...log.attributes,
52
- 'server.address': serverName,
53
- };
54
- });
55
- }
56
-
57
- process.on('beforeExit', this._logOnExitFlushListener);
58
- }
59
- }
60
-
61
- /** Get the OTEL tracer. */
62
- get tracer() {
63
- if (this._tracer) {
64
- return this._tracer;
65
- }
66
-
67
- const name = '@sentry/node';
68
- const version = core.SDK_VERSION;
69
- const tracer = api.trace.getTracer(name, version);
70
- this._tracer = tracer;
71
-
72
- return tracer;
73
- }
74
-
75
- // Eslint ignore explanation: This is already documented in super.
76
- // eslint-disable-next-line jsdoc/require-jsdoc
77
- async flush(timeout) {
78
- const provider = this.traceProvider;
79
- const spanProcessor = provider?.activeSpanProcessor;
80
-
81
- if (spanProcessor) {
82
- await spanProcessor.forceFlush();
83
- }
84
-
85
- if (this.getOptions().sendClientReports) {
86
- this._flushOutcomes();
87
- }
88
-
89
- return super.flush(timeout);
90
- }
91
-
92
- // Eslint ignore explanation: This is already documented in super.
93
- // eslint-disable-next-line jsdoc/require-jsdoc
94
- close(timeout) {
95
- if (this._clientReportInterval) {
96
- clearInterval(this._clientReportInterval);
97
- }
98
-
99
- if (this._clientReportOnExitFlushListener) {
100
- process.off('beforeExit', this._clientReportOnExitFlushListener);
101
- }
102
-
103
- if (this._logOnExitFlushListener) {
104
- process.off('beforeExit', this._logOnExitFlushListener);
105
- }
106
-
107
- return super.close(timeout);
108
- }
109
-
110
- /**
111
- * Will start tracking client reports for this client.
112
- *
113
- * NOTICE: This method will create an interval that is periodically called and attach a `process.on('beforeExit')`
114
- * hook. To clean up these resources, call `.close()` when you no longer intend to use the client. Not doing so will
115
- * result in a memory leak.
116
- */
117
- // The reason client reports need to be manually activated with this method instead of just enabling them in a
118
- // constructor, is that if users periodically and unboundedly create new clients, we will create more and more
119
- // intervals and beforeExit listeners, thus leaking memory. In these situations, users are required to call
120
- // `client.close()` in order to dispose of the acquired resources.
121
- // We assume that calling this method in Sentry.init() is a sensible default, because calling Sentry.init() over and
122
- // over again would also result in memory leaks.
123
- // Note: We have experimented with using `FinalizationRegisty` to clear the interval when the client is garbage
124
- // collected, but it did not work, because the cleanup function never got called.
125
- startClientReportTracking() {
126
- const clientOptions = this.getOptions();
127
- if (clientOptions.sendClientReports) {
128
- this._clientReportOnExitFlushListener = () => {
129
- this._flushOutcomes();
130
- };
131
-
132
- this._clientReportInterval = setInterval(() => {
133
- debugBuild.DEBUG_BUILD && core.logger.log('Flushing client reports based on interval.');
134
- this._flushOutcomes();
135
- }, clientOptions.clientReportFlushInterval ?? DEFAULT_CLIENT_REPORT_FLUSH_INTERVAL_MS)
136
- // Unref is critical for not preventing the process from exiting because the interval is active.
137
- .unref();
138
-
139
- process.on('beforeExit', this._clientReportOnExitFlushListener);
140
- }
141
- }
142
-
143
- /** Custom implementation for OTEL, so we can handle scope-span linking. */
144
- _getTraceInfoFromScope(
145
- scope,
146
- ) {
147
- if (!scope) {
148
- return [undefined, undefined];
149
- }
150
-
151
- return opentelemetry.getTraceContextForScope(this, scope);
152
- }
153
- }
154
-
155
- exports.NodeClient = NodeClient;
156
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sources":["../../../src/sdk/client.ts"],"sourcesContent":["import * as os from 'node:os';\nimport type { Tracer } from '@opentelemetry/api';\nimport { trace } from '@opentelemetry/api';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport type { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport type { DynamicSamplingContext, Scope, ServerRuntimeClientOptions, TraceContext } from '@sentry/core';\nimport { _INTERNAL_flushLogsBuffer, applySdkMetadata, logger, SDK_VERSION, ServerRuntimeClient } from '@sentry/core';\nimport { getTraceContextForScope } from '@sentry/opentelemetry';\nimport { isMainThread, threadId } from 'worker_threads';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { NodeClientOptions } from '../types';\n\nconst DEFAULT_CLIENT_REPORT_FLUSH_INTERVAL_MS = 60_000; // 60s was chosen arbitrarily\n\n/** A client for using Sentry with Node & OpenTelemetry. */\nexport class NodeClient extends ServerRuntimeClient<NodeClientOptions> {\n public traceProvider: BasicTracerProvider | undefined;\n private _tracer: Tracer | undefined;\n private _clientReportInterval: NodeJS.Timeout | undefined;\n private _clientReportOnExitFlushListener: (() => void) | undefined;\n private _logOnExitFlushListener: (() => void) | undefined;\n\n public constructor(options: NodeClientOptions) {\n const serverName =\n options.includeServerName === false\n ? undefined\n : options.serverName || global.process.env.SENTRY_NAME || os.hostname();\n\n const clientOptions: ServerRuntimeClientOptions = {\n ...options,\n platform: 'node',\n runtime: { name: 'node', version: global.process.version },\n serverName,\n };\n\n if (options.openTelemetryInstrumentations) {\n registerInstrumentations({\n instrumentations: options.openTelemetryInstrumentations,\n });\n }\n\n applySdkMetadata(clientOptions, 'node');\n\n logger.log(\n `Initializing Sentry: process: ${process.pid}, thread: ${isMainThread ? 'main' : `worker-${threadId}`}.`,\n );\n\n super(clientOptions);\n\n if (this.getOptions()._experiments?.enableLogs) {\n this._logOnExitFlushListener = () => {\n _INTERNAL_flushLogsBuffer(this);\n };\n\n if (serverName) {\n this.on('beforeCaptureLog', log => {\n log.attributes = {\n ...log.attributes,\n 'server.address': serverName,\n };\n });\n }\n\n process.on('beforeExit', this._logOnExitFlushListener);\n }\n }\n\n /** Get the OTEL tracer. */\n public get tracer(): Tracer {\n if (this._tracer) {\n return this._tracer;\n }\n\n const name = '@sentry/node';\n const version = SDK_VERSION;\n const tracer = trace.getTracer(name, version);\n this._tracer = tracer;\n\n return tracer;\n }\n\n // Eslint ignore explanation: This is already documented in super.\n // eslint-disable-next-line jsdoc/require-jsdoc\n public async flush(timeout?: number): Promise<boolean> {\n const provider = this.traceProvider;\n const spanProcessor = provider?.activeSpanProcessor;\n\n if (spanProcessor) {\n await spanProcessor.forceFlush();\n }\n\n if (this.getOptions().sendClientReports) {\n this._flushOutcomes();\n }\n\n return super.flush(timeout);\n }\n\n // Eslint ignore explanation: This is already documented in super.\n // eslint-disable-next-line jsdoc/require-jsdoc\n public close(timeout?: number | undefined): PromiseLike<boolean> {\n if (this._clientReportInterval) {\n clearInterval(this._clientReportInterval);\n }\n\n if (this._clientReportOnExitFlushListener) {\n process.off('beforeExit', this._clientReportOnExitFlushListener);\n }\n\n if (this._logOnExitFlushListener) {\n process.off('beforeExit', this._logOnExitFlushListener);\n }\n\n return super.close(timeout);\n }\n\n /**\n * Will start tracking client reports for this client.\n *\n * NOTICE: This method will create an interval that is periodically called and attach a `process.on('beforeExit')`\n * hook. To clean up these resources, call `.close()` when you no longer intend to use the client. Not doing so will\n * result in a memory leak.\n */\n // The reason client reports need to be manually activated with this method instead of just enabling them in a\n // constructor, is that if users periodically and unboundedly create new clients, we will create more and more\n // intervals and beforeExit listeners, thus leaking memory. In these situations, users are required to call\n // `client.close()` in order to dispose of the acquired resources.\n // We assume that calling this method in Sentry.init() is a sensible default, because calling Sentry.init() over and\n // over again would also result in memory leaks.\n // Note: We have experimented with using `FinalizationRegisty` to clear the interval when the client is garbage\n // collected, but it did not work, because the cleanup function never got called.\n public startClientReportTracking(): void {\n const clientOptions = this.getOptions();\n if (clientOptions.sendClientReports) {\n this._clientReportOnExitFlushListener = () => {\n this._flushOutcomes();\n };\n\n this._clientReportInterval = setInterval(() => {\n DEBUG_BUILD && logger.log('Flushing client reports based on interval.');\n this._flushOutcomes();\n }, clientOptions.clientReportFlushInterval ?? DEFAULT_CLIENT_REPORT_FLUSH_INTERVAL_MS)\n // Unref is critical for not preventing the process from exiting because the interval is active.\n .unref();\n\n process.on('beforeExit', this._clientReportOnExitFlushListener);\n }\n }\n\n /** Custom implementation for OTEL, so we can handle scope-span linking. */\n protected _getTraceInfoFromScope(\n scope: Scope | undefined,\n ): [dynamicSamplingContext: Partial<DynamicSamplingContext> | undefined, traceContext: TraceContext | undefined] {\n if (!scope) {\n return [undefined, undefined];\n }\n\n return getTraceContextForScope(this, scope);\n }\n}\n"],"names":["ServerRuntimeClient","registerInstrumentations","applySdkMetadata","logger","isMainThread","threadId","_INTERNAL_flushLogsBuffer","SDK_VERSION","trace","DEBUG_BUILD","getTraceContextForScope"],"mappings":";;;;;;;;;;AAYA,MAAM,uCAAA,GAA0C,KAAM,CAAA;;AAEtD;AACO,MAAM,UAAA,SAAmBA,wBAAmB,CAAoB;;AAOvE,GAAS,WAAW,CAAC,OAAO,EAAqB;AACjD,IAAI,MAAM,UAAW;AACrB,MAAM,OAAO,CAAC,iBAAA,KAAsB;AACpC,UAAU;AACV,UAAU,OAAO,CAAC,UAAW,IAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAY,IAAG,EAAE,CAAC,QAAQ,EAAE;;AAE/E,IAAI,MAAM,aAAa,GAA+B;AACtD,MAAM,GAAG,OAAO;AAChB,MAAM,QAAQ,EAAE,MAAM;AACtB,MAAM,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS;AAChE,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