@supabase/supabase-js 2.112.2 → 2.112.3
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.
- package/README.md +4 -2
- package/dist/cors.cjs +11 -4
- package/dist/cors.cjs.map +1 -1
- package/dist/cors.d.cts +4 -3
- package/dist/cors.d.cts.map +1 -1
- package/dist/cors.d.mts +4 -3
- package/dist/cors.d.mts.map +1 -1
- package/dist/cors.mjs +11 -4
- package/dist/cors.mjs.map +1 -1
- package/dist/index.cjs +12 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +10 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/dist/tracing.cjs +10 -3
- package/dist/tracing.cjs.map +1 -1
- package/dist/tracing.mjs +10 -3
- package/dist/tracing.mjs.map +1 -1
- package/dist/umd/supabase.js +7 -7
- package/package.json +6 -6
- package/src/cors.ts +10 -3
- package/src/lib/fetch.ts +32 -1
- package/src/lib/types.ts +10 -7
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/supabase-js",
|
|
3
|
-
"version": "2.112.
|
|
3
|
+
"version": "2.112.3",
|
|
4
4
|
"description": "Isomorphic Javascript SDK for Supabase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
"directory": "packages/core/supabase-js"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@supabase/auth-js": "2.112.
|
|
81
|
-
"@supabase/
|
|
82
|
-
"@supabase/
|
|
83
|
-
"@supabase/realtime-js": "2.112.
|
|
84
|
-
"@supabase/storage-js": "2.112.
|
|
80
|
+
"@supabase/auth-js": "2.112.3",
|
|
81
|
+
"@supabase/postgrest-js": "2.112.3",
|
|
82
|
+
"@supabase/functions-js": "2.112.3",
|
|
83
|
+
"@supabase/realtime-js": "2.112.3",
|
|
84
|
+
"@supabase/storage-js": "2.112.3"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@opentelemetry/api": ">=1.0.0"
|
package/src/cors.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Canonical CORS configuration for Supabase Edge Functions
|
|
3
3
|
*
|
|
4
|
-
* This module exports CORS headers
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* This module exports CORS headers kept in sync with the headers the Supabase
|
|
5
|
+
* SDK sends. Using it in Edge Functions prevents CORS preflight errors when the
|
|
6
|
+
* SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts
|
|
7
|
+
* sending one (enforced by the unit tests).
|
|
7
8
|
*
|
|
8
9
|
* @example Basic usage
|
|
9
10
|
* ```typescript
|
|
@@ -34,6 +35,9 @@
|
|
|
34
35
|
* - apikey: Project API key
|
|
35
36
|
* - content-type: Standard HTTP content type
|
|
36
37
|
* - x-retry-count: Retry attempt number sent by postgrest-js on retried requests
|
|
38
|
+
* - traceparent: W3C trace context sent when `tracePropagation` is enabled
|
|
39
|
+
* - tracestate: Vendor-specific trace data sent alongside traceparent
|
|
40
|
+
* - baggage: W3C baggage sent alongside traceparent
|
|
37
41
|
*/
|
|
38
42
|
const SUPABASE_HEADERS = [
|
|
39
43
|
'authorization',
|
|
@@ -41,6 +45,9 @@ const SUPABASE_HEADERS = [
|
|
|
41
45
|
'apikey',
|
|
42
46
|
'content-type',
|
|
43
47
|
'x-retry-count',
|
|
48
|
+
'traceparent',
|
|
49
|
+
'tracestate',
|
|
50
|
+
'baggage',
|
|
44
51
|
].join(', ')
|
|
45
52
|
|
|
46
53
|
/**
|
package/src/lib/fetch.ts
CHANGED
|
@@ -115,6 +115,7 @@ export const fetchWithAuth = (
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
let warnedMissingTracingRuntime = false
|
|
118
|
+
let warnedNonW3CPropagator = false
|
|
118
119
|
|
|
119
120
|
/**
|
|
120
121
|
* For tests only. Resets the one-time missing-tracing-runtime warning.
|
|
@@ -125,6 +126,15 @@ export function _resetTracingRuntimeWarning(): void {
|
|
|
125
126
|
warnedMissingTracingRuntime = false
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
/**
|
|
130
|
+
* For tests only. Resets the one-time non-W3C-propagator warning.
|
|
131
|
+
*
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
export function _resetNonW3CPropagatorWarning(): void {
|
|
135
|
+
warnedNonW3CPropagator = false
|
|
136
|
+
}
|
|
137
|
+
|
|
128
138
|
function getTraceHeaders(
|
|
129
139
|
input: RequestInfo | URL,
|
|
130
140
|
targets: TracePropagationTarget[],
|
|
@@ -161,13 +171,34 @@ function getTraceHeaders(
|
|
|
161
171
|
const traceContext = extractTraceContext()
|
|
162
172
|
|
|
163
173
|
if (!traceContext || !traceContext.traceparent) {
|
|
174
|
+
// An active propagator that writes vendor headers but no W3C
|
|
175
|
+
// `traceparent` (e.g. Sentry without `propagateTraceparent: true`) is
|
|
176
|
+
// otherwise indistinguishable from "no active trace" — warn once so the
|
|
177
|
+
// user learns why no trace headers are attached. An empty carrier means
|
|
178
|
+
// no active trace: normal, stay silent.
|
|
179
|
+
if (traceContext?.carrierKeys?.length && !warnedNonW3CPropagator) {
|
|
180
|
+
warnedNonW3CPropagator = true
|
|
181
|
+
const sentryHint = traceContext.carrierKeys.includes('sentry-trace')
|
|
182
|
+
? ' Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it.'
|
|
183
|
+
: ' Configure your tracing SDK to emit W3C trace context on outgoing requests.'
|
|
184
|
+
console.warn(
|
|
185
|
+
'@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its ' +
|
|
186
|
+
`propagator wrote [${traceContext.carrierKeys.join(', ')}] and no W3C traceparent header, ` +
|
|
187
|
+
'so trace headers will not be attached.' +
|
|
188
|
+
sentryHint
|
|
189
|
+
)
|
|
190
|
+
}
|
|
164
191
|
return null
|
|
165
192
|
}
|
|
166
193
|
|
|
167
194
|
if (respectSampling) {
|
|
168
195
|
const parsed = parseTraceParent(traceContext.traceparent)
|
|
169
196
|
if (parsed && !parsed.isSampled) {
|
|
170
|
-
|
|
197
|
+
// Unsampled traces still carry `traceparent` so Supabase logs get a
|
|
198
|
+
// trace_id to correlate on; the flag stays `00`, so downstream tracing
|
|
199
|
+
// never records it as sampled. `tracestate` and `baggage` (the
|
|
200
|
+
// vendor/application data channels) are withheld on these requests.
|
|
201
|
+
return { traceparent: traceContext.traceparent }
|
|
171
202
|
}
|
|
172
203
|
}
|
|
173
204
|
|
package/src/lib/types.ts
CHANGED
|
@@ -80,17 +80,20 @@ export interface TracePropagationOptions {
|
|
|
80
80
|
/**
|
|
81
81
|
* Respect upstream sampling decisions.
|
|
82
82
|
*
|
|
83
|
-
* When true (the default), trace
|
|
84
|
-
*
|
|
85
|
-
* header
|
|
83
|
+
* When true (the default), requests whose upstream trace is not sampled
|
|
84
|
+
* (sampled flag = `0` in the `traceparent` header) carry only the
|
|
85
|
+
* `traceparent` header — the sampled flag is preserved, so downstream
|
|
86
|
+
* tracing never records them, while Supabase logs still get a `trace_id`
|
|
87
|
+
* to correlate on. The `tracestate` and `baggage` headers are withheld on
|
|
88
|
+
* these requests.
|
|
86
89
|
*
|
|
87
|
-
* Set to `false` to always propagate
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
+
* Set to `false` to always propagate the full trace context
|
|
91
|
+
* (`traceparent`, `tracestate`, `baggage`) regardless of the sampling
|
|
92
|
+
* decision.
|
|
90
93
|
*
|
|
91
94
|
* @default true
|
|
92
95
|
*
|
|
93
|
-
* @example Always propagate, ignore sampling
|
|
96
|
+
* @example Always propagate the full context, ignore sampling
|
|
94
97
|
* ```ts
|
|
95
98
|
* import '@supabase/supabase-js/tracing'
|
|
96
99
|
*
|
package/src/lib/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.112.
|
|
7
|
+
export const version = '2.112.3'
|