diff --git a/apps/backend/src/lib/workflows.tsx b/apps/backend/src/lib/workflows.tsx index 02fa54f08..e1e302f37 100644 --- a/apps/backend/src/lib/workflows.tsx +++ b/apps/backend/src/lib/workflows.tsx @@ -165,9 +165,10 @@ async function compileWorkflow(tenancy: Tenancy, workflowId: string): Promise 0) { - captureError("workflows-compile-timeout", new StackAssertionError(`Deleted ${count} currently compiling workflows that were compiling for more than 20 seconds; this probably indicates a bug in the workflow compilation code`)); + captureError("workflows-compile-timeout", new StackAssertionError(`Deleted ${count} currently compiling workflows that were compiling for more than 40 seconds; this probably indicates a bug in the workflow compilation code (as they should time out after 30 seconds)`)); } await wait(1000); diff --git a/apps/e2e/tests/backend/backend-helpers.ts b/apps/e2e/tests/backend/backend-helpers.ts index 743ad2ebe..154b0c2d1 100644 --- a/apps/e2e/tests/backend/backend-helpers.ts +++ b/apps/e2e/tests/backend/backend-helpers.ts @@ -203,6 +203,18 @@ export namespace Auth { } } + export async function refreshAccessToken() { + const response = await niceBackendFetch("/api/v1/auth/sessions/current/refresh", { method: "POST", accessType: "client" }); + if (response.status !== 200) { + throw new StackAssertionError("Expected session to be valid, but was actually invalid.", { response }); + } + backendContext.set({ userAuth: { accessToken: response.body.access_token, refreshToken: response.body.refresh_token } }); + await ensureParsableAccessToken(); + return { + refreshAccessTokenResponse: response, + }; + } + /** * Valid session & valid access token: OK * Valid session & invalid access token: OK diff --git a/apps/e2e/tests/backend/workflows.test.ts b/apps/e2e/tests/backend/workflows.test.ts index cd2355142..7b4d11dd4 100644 --- a/apps/e2e/tests/backend/workflows.test.ts +++ b/apps/e2e/tests/backend/workflows.test.ts @@ -216,6 +216,7 @@ test("disabled workflows do not trigger", async ({ expect }) => { await Auth.Password.signUpWithEmail({ password: "password" }); await wait(waitRetries * 1_000 * 1.3); + await Auth.refreshAccessToken(); expect(await mailbox.fetchMessages()).toMatchInlineSnapshot(` [ @@ -304,6 +305,7 @@ test("anonymous sign-up does not trigger; upgrade triggers workflow", async ({ e // ensure marker not present yet await wait(waitRetries * 1_000 * 1.3); + await Auth.refreshAccessToken(); const me1 = await niceBackendFetch("/api/v1/users/me", { accessType: "client" }); expect(me1.body.server_metadata?.[markerKey]).toBeUndefined();