Repository navigation
fix(web): ship email templates and load postmark in the production web image - #294
Merged
Merged
Conversation
templates/ sits at the repo root, outside every workspace package, so turbo prune drops it from out/full/ and the runner stage never copied it. Every sendEmail call in the image returned 'Template "…" not found'. Refs #253
…bundle sendEmail is transpiled into the web server bundle, so nulling postmark made new ServerClient() throw and every Postmark send fall back to console output. Refs #253
…ction image Fixes #253
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #253
Problem
Email could not work in the production
outpost-webimage, for two separate reasons:templates/is at the repo root, outside every workspace package.turbo prune --dockerleaves it out ofout/full/, and the runner stage never copied it.findTemplatesDir()found nothing, so everysendEmailreturnedTemplate "…" not foundand invites came back withemailSent: false. (.dockerignore's*.mdis root-level only, so the files are in the build context; the pruner stage has them.)next.config.tsaliasedpostmarktofalsefor the server build.sendEmailis transpiled into that bundle (transpilePackages), sonew ServerClient()threw,createPostmarkTransport()returnednull, and the send fell through to the console fallback. This was masked by (1).Fix
apps/web/Dockerfile: runner stage copies/app/templatesfrom the pruner stage. The standalone server chdirs to/app/apps/web, and the loader's../../templatescandidate resolves to/app/templates.apps/web/next.config.ts: droppostmarkfrom the server null-alias list.nodemailerstays nulled (not installed; prod has noSMTP_*config, Postmark is the transport). The rest of the file diff is Prettier reflow, which CI's changed-file format check requires.apps/web/src/__tests__/production-email-image.test.ts: guards that the runner stage copies templates to/app/templatesand that the server webpack config does not aliaspostmark. Both assertions fail onmainand pass here.The worker image is unchanged: the worker does not load templates or send email.
Red-green proof (real surface: the built image)
Harness: built
apps/web/Dockerfilelocally, ran it next to Postgres and a fakeapi.postmarkapp.com(TLS sink on a Docker network alias,NODE_TLS_REJECT_UNAUTHORIZED=0, fakePOSTMARK_SERVER_TOKEN). Real flow:/api/setup→ credentials sign-in →POST /api/templates/invite/preview→POST /api/team/invite. No real email left the machine. Tokens redacted.RED:
mainRED: templates fixed,
postmarkalias still in place (isolates the second bug)GREEN: this branch (image rebuilt from the final commit)
Guard test:
main→ 2 failed / 1 passed. This branch → 3 passed. Fullapps/websuite: 859 passed. Typecheck clean.Still needed for email to actually send in production
Production
outpost-webhas noPOSTMARK_SERVER_TOKEN(and noSMTP_*). Until a token is set,sendEmailuses the console fallback. Sender domain DNS is #215.