Skip to content

Commit 69e4a40

Browse files
authored
fix: expose etag headers required for s3 multipart uploads in browser (#691)
* fix: expose etag headers required for s3 multipart uploads in browser * Make tenant test always use latest migration in payload * fix test so it cleans up correctly * add timeout to github action
1 parent 9d3fe0a commit 69e4a40

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
node: ['20']
2121

2222
runs-on: ${{ matrix.platform }}
23+
timeout-minutes: 15
2324

2425
steps:
2526
- uses: actions/checkout@v4

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
# Base stage for shared environment setup
2-
FROM node:22-alpine3.21 as base
2+
FROM node:22-alpine3.21 AS base
33
RUN apk add --no-cache g++ make python3
44
WORKDIR /app
55
COPY package.json package-lock.json ./
66

77
# Dependencies stage - install and cache all dependencies
8-
FROM base as dependencies
8+
FROM base AS dependencies
99
RUN npm ci
1010
# Cache the installed node_modules for later stages
1111
RUN cp -R node_modules /node_modules_cache
1212

1313
# Build stage - use cached node_modules for building the application
14-
FROM base as build
14+
FROM base AS build
1515
COPY --from=dependencies /node_modules_cache ./node_modules
1616
COPY . .
1717
RUN npm run build
1818

1919
# Production dependencies stage - use npm cache to install only production dependencies
20-
FROM base as production-deps
20+
FROM base AS production-deps
2121
COPY --from=dependencies /node_modules_cache ./node_modules
2222
RUN npm ci --production
2323

2424
# Final stage - for the production build
25-
FROM base as final
25+
FROM base AS final
2626
ARG VERSION
2727
ENV VERSION=$VERSION
2828
COPY migrations migrations

src/storage/protocols/s3/s3-handler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ export class S3ProtocolHandler {
618618
return {
619619
headers: {
620620
etag: uploadPart.ETag || '',
621+
'Access-Control-Expose-Headers': 'etag',
621622
},
622623
}
623624
} catch (e) {

src/test/bucket.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ describe('testing POST bucket', () => {
222222

223223
test('user is not able to create a bucket with a name longer than 100 characters', async () => {
224224
const longBucketName = 'a'.repeat(101)
225-
const response = await app().inject({
225+
const response = await appInstance.inject({
226226
method: 'POST',
227227
url: `/bucket`,
228228
headers: {

src/test/tenant.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ import {
1010
getTenantConfig,
1111
} from '@internal/database/tenant'
1212
import { signJWT } from '@internal/auth'
13+
import { DBMigration } from '@internal/database/migrations'
1314

1415
dotenv.config({ path: '.env.test' })
1516

1617
const serviceKeyPayload = { abc: 123 }
1718

19+
const migrationVersion = Object.entries(DBMigration).sort(([_, a], [__, b]) => b - a)[0][0]
20+
1821
const payload = {
1922
anonKey: 'a',
2023
databasePoolMode: null,
@@ -26,7 +29,7 @@ const payload = {
2629
serviceKey: 'd',
2730
jwks: { keys: [] },
2831
migrationStatus: 'COMPLETED',
29-
migrationVersion: 'optimise-existing-functions',
32+
migrationVersion,
3033
tracingMode: 'basic',
3134
features: {
3235
imageTransformation: {
@@ -54,7 +57,7 @@ const payload2 = {
5457
serviceKey: 'h',
5558
jwks: null,
5659
migrationStatus: 'COMPLETED',
57-
migrationVersion: 'optimise-existing-functions',
60+
migrationVersion,
5861
tracingMode: 'basic',
5962
features: {
6063
imageTransformation: {

0 commit comments

Comments
 (0)