Skip to content

Commit e0b4d63

Browse files
authored
Fix Aspire AppHost not building email templates before APIs become ready (#886)
### Summary & Motivation After the localized-emails feature merged to main, starting Aspire on a fresh clone (or any environment without a populated `application/account/WebApp/emails/dist/` folder) returned HTTP 500 from every email-sending endpoint with `System.IO.FileNotFoundException: Email template 'StartSignup.en-US.html' not found`. The crash cascaded through 11 of 14 e2e smoke tests. The dist folder is a gitignored build artifact only populated by the `@repo/emails#build` turbo task; nothing in the dev pipeline triggered that task before the AppGateway accepted requests. - Add `@repo/emails#build` to `dev:setup`'s `dependsOn` in `application/turbo.json`. The Aspire AppHost's `frontendBuild` resource runs `npm start` → `turbo dev`, and `dev` depends on `dev:setup`. Hooking `@repo/emails#build` into `dev:setup` makes turbo block every package's dev server until the email dist exists. The same flow protects every entry point that funnels through `turbo dev` — `pp restart`, `pp run`, `pp e2e`, `dotnet run --project AppHost`, and any IDE-launched AppHost. - Update the UnknownUser e2e assertions in `application/account/WebApp/tests/e2e/localized-email-flows.spec.ts` to match the Slack-style copy the email template was rewritten to use ("No account found" / "Is this the right email address?" in English, "Ingen konto fundet" / "Er det den rigtige e-mailadresse?" in Danish). The previous strings ("Unknown user tried to login to PlatformPlatform" / "You or someone else tried to login to PlatformPlatform") no longer exist in the rendered emails. ### Checklist - [x] I have added tests, or done manual regression tests - [x] I have updated the documentation, if necessary
2 parents b7033ae + 5d67672 commit e0b4d63

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

application/account/WebApp/tests/e2e/localized-email-flows.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ test.describe("@comprehensive", () => {
238238
await step("Fetch en-US unknown user email from Mailpit & assert subject, HTML, and plaintext")(async () => {
239239
const mail = await fetchLatestMailByRecipient(enUnknownEmail);
240240

241-
expect(mail.subject).toBe("Unknown user tried to login to PlatformPlatform");
242-
expect(mail.html).toContain("You or someone else tried to login to PlatformPlatform");
241+
expect(mail.subject).toBe("No account found");
242+
expect(mail.html).toContain("Is this the right email address?");
243243
expect(mail.html).toContain(enUnknownEmail);
244-
expect(mail.text).toContain("You or someone else tried to login to PlatformPlatform");
244+
expect(mail.text).toContain("Is this the right email address?");
245245
expect(mail.text).toContain(enUnknownEmail);
246246
})();
247247

@@ -261,10 +261,10 @@ test.describe("@comprehensive", () => {
261261
async () => {
262262
const mail = await fetchLatestMailByRecipient(daUnknownEmail);
263263

264-
expect(mail.subject).toBe("Ukendt bruger forsøgte at logge ind på PlatformPlatform");
265-
expect(mail.html).toContain("Du eller en anden forsøgte at logge ind på PlatformPlatform");
264+
expect(mail.subject).toBe("Ingen konto fundet");
265+
expect(mail.html).toContain("Er det den rigtige e-mailadresse?");
266266
expect(mail.html).toContain(daUnknownEmail);
267-
expect(mail.text).toContain("Du eller en anden forsøgte at logge ind på PlatformPlatform");
267+
expect(mail.text).toContain("Er det den rigtige e-mailadresse?");
268268
expect(mail.text).toContain(daUnknownEmail);
269269
}
270270
)();

application/turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dependsOn": ["dev:setup"]
3838
},
3939
"dev:setup": {
40-
"dependsOn": ["^dev:setup"],
40+
"dependsOn": ["^dev:setup", "@repo/emails#build"],
4141
"inputs": ["$TURBO_DEFAULT$", "shared/lib/api/*.Api.json", "shared/lib/api/*.Api_*.json"],
4242
"outputs": ["dist/**", "shared/lib/api/*.generated.d.ts"]
4343
},

0 commit comments

Comments
 (0)