Skip to content

Commit f64c7cb

Browse files
authored
fix: frontend cold start crash loop due to uncached deps (#1347)
1 parent 68551a1 commit f64c7cb

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

frontend/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ COPY . .
66

77
RUN deno task build
88
RUN rm -rf $DENO_DIR
9-
RUN deno install --allow-import -e main.ts
10-
11-
RUN timeout 2s deno run -A --cached-only main.ts || true
9+
RUN deno install
10+
RUN deno install --allow-import -e _fresh/server.js
1211

1312
ENV PORT=8000
1413

15-
CMD deno serve -A --port=$PORT _fresh/server.js
14+
CMD deno serve -A --cached-only --port=$PORT _fresh/server.js

frontend/routes/_middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const auth = define.middleware(async (ctx) => {
8686

8787
const cache = define.middleware(async (ctx) => {
8888
const resp = await ctx.next();
89-
if (!ctx.state.api.hasToken() && ctx.state.cacheControl) {
89+
if (ctx.state.api && !ctx.state.api.hasToken() && ctx.state.cacheControl) {
9090
resp.headers.set("cache-control", ctx.state.cacheControl);
9191
}
9292
return resp;

0 commit comments

Comments
 (0)