Skip to content

Commit 54d9496

Browse files
authored
Fix - resolve file upload failures in pre-prod environments (#183)
Fix - resolve file upload failures in pre-prod environments File uploads are failing in pre-prod because S3 file upload endpoints require JWT authentication but the main page (form publish) routes don't, meaning the necessary fsd_user_token cookie doesn't get set beforehand. This commit makes JWT authentication global, meaning that in a given environment, all endpoints will either be JWT authenticated or not. We can disable JWT auth in Dev, Test and UAT, resolving the weirdness we have observed.
1 parent a3ca67f commit 54d9496

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

copilot/fsd-form-runner-adapter/manifest.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ secrets:
8282
environments:
8383
dev:
8484
variables:
85+
JWT_AUTH_ENABLED: false
8586
PREVIEW_MODE: true
8687
count:
8788
spot: 2
@@ -104,6 +105,7 @@ environments:
104105

105106
test:
106107
variables:
108+
JWT_AUTH_ENABLED: false
107109
PREVIEW_MODE: true
108110
count:
109111
spot: 2
@@ -126,6 +128,7 @@ environments:
126128

127129
uat:
128130
variables:
131+
JWT_AUTH_ENABLED: false
129132
PREVIEW_MODE: true
130133
count:
131134
range: 2-4

runner/src/server/plugins/engine/api/RegisterFormPublishApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class RegisterFormPublishApi implements RegisterApi {
246246

247247
// TODO: Stop being naughty! Conditionally disabling auth for pre-prod envs is a temporary measure for getting
248248
// FAB into production
249-
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true" && config.copilotEnv === "prod") {
249+
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true") {
250250
getOptions.options.auth = jwtAuthStrategyName
251251
}
252252

@@ -311,7 +311,7 @@ export class RegisterFormPublishApi implements RegisterApi {
311311
handler: postHandler,
312312
}
313313
}
314-
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true" && config.copilotEnv === "prod") {
314+
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true") {
315315
postConfig.options.auth = jwtAuthStrategyName
316316
}
317317
server.route(postConfig);

0 commit comments

Comments
 (0)