Skip to content

Commit 53cbaa7

Browse files
authored
fix: custom trace spans (#547)
1 parent 1abf34e commit 53cbaa7

30 files changed

+2173
-1963
lines changed

package-lock.json

Lines changed: 1171 additions & 1319 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "supa-storage",
3-
"version": "0.9.5",
4-
"description": "Supabase storage middleend",
3+
"version": "1.11.2",
4+
"description": "Supabase Storage Service",
55
"main": "index.js",
66
"scripts": {
77
"dev": "tsx watch src/start/server.ts | pino-pretty",
@@ -32,16 +32,15 @@
3232
"@fastify/multipart": "^8.3.0",
3333
"@fastify/rate-limit": "^7.6.0",
3434
"@fastify/swagger": "^8.3.1",
35-
"@fastify/swagger-ui": "^1.7.0",
35+
"@fastify/swagger-ui": "^4.1.0",
3636
"@isaacs/ttlcache": "^1.4.1",
3737
"@opentelemetry/api": "^1.8.0",
38-
"@opentelemetry/auto-instrumentations-node": "^0.46.1",
39-
"@opentelemetry/instrumentation-aws-sdk": "^0.41.0",
40-
"@opentelemetry/instrumentation-fastify": "^0.36.1",
41-
"@opentelemetry/instrumentation-http": "^0.51.1",
42-
"@opentelemetry/instrumentation-knex": "^0.36.1",
43-
"@opentelemetry/instrumentation-pg": "^0.41.0",
44-
"@opentelemetry/instrumentation-pino": "^0.39.0",
38+
"@opentelemetry/auto-instrumentations-node": "^0.50.0",
39+
"@opentelemetry/instrumentation-aws-sdk": "^0.44.0",
40+
"@opentelemetry/instrumentation-fastify": "^0.39.0",
41+
"@opentelemetry/instrumentation-http": "^0.53.0",
42+
"@opentelemetry/instrumentation-knex": "^0.40.0",
43+
"@opentelemetry/instrumentation-pg": "^0.44.0",
4544
"@shopify/semaphore": "^3.0.2",
4645
"@smithy/node-http-handler": "^2.3.1",
4746
"@tus/file-store": "1.4.0",

src/admin-app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Registry } from 'prom-client'
55
const build = (opts: FastifyServerOptions = {}, appInstance?: FastifyInstance): FastifyInstance => {
66
const app = fastify(opts)
77
app.register(plugins.adminTenantId)
8-
app.register(plugins.logTenantId)
98
app.register(plugins.logRequest({ excludeUrls: ['/status', '/metrics', '/health'] }))
109
app.register(routes.tenants, { prefix: 'tenants' })
1110
app.register(routes.migrations, { prefix: 'migrations' })

src/app.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const build = (opts: buildOpts = {}): FastifyInstance => {
3737
{ name: 's3', description: 'S3 end-points' },
3838
{ name: 'transformation', description: 'Image transformation' },
3939
{ name: 'resumable', description: 'Resumable Upload end-points' },
40-
{ name: 'deprecated', description: 'Deprecated end-points' },
4140
],
4241
},
4342
})
@@ -52,7 +51,6 @@ const build = (opts: buildOpts = {}): FastifyInstance => {
5251
app.addSchema(schemas.errorSchema)
5352

5453
app.register(plugins.tenantId)
55-
app.register(plugins.logTenantId)
5654
app.register(plugins.metrics({ enabledEndpoint: !isMultitenant }))
5755
app.register(plugins.tracing)
5856
app.register(plugins.logRequest({ excludeUrls: ['/status', '/metrics', '/health'] }))

src/http/plugins/apikey.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import fastifyPlugin from 'fastify-plugin'
22
import { getConfig } from '../../config'
33

4-
export default fastifyPlugin(async (fastify) => {
5-
const { adminApiKeys } = getConfig()
6-
const apiKeys = new Set(adminApiKeys.split(','))
7-
fastify.addHook('onRequest', async (request, reply) => {
8-
if (typeof request.headers.apikey !== 'string' || !apiKeys.has(request.headers.apikey)) {
9-
reply.status(401).send()
10-
}
11-
})
12-
})
4+
export default fastifyPlugin(
5+
async (fastify) => {
6+
const { adminApiKeys } = getConfig()
7+
const apiKeys = new Set(adminApiKeys.split(','))
8+
fastify.addHook('onRequest', async (request, reply) => {
9+
if (typeof request.headers.apikey !== 'string' || !apiKeys.has(request.headers.apikey)) {
10+
reply.status(401).send()
11+
}
12+
})
13+
},
14+
{ name: 'auth-admin-api-key' }
15+
)

0 commit comments

Comments
 (0)