Skip to content

Commit

Permalink
fix(cloudflare): adapter returning an empty 404 page (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Arsh <69170106+lilnasy@users.noreply.github.com>
Co-authored-by: lilnasy <69170106+lilnasy@users.noreply.github.com>
Co-authored-by: Alexander Niebuhr <alexander@nbhr.io>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent 79c4176 commit 5b62509
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-grapes-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/cloudflare': patch
---

Fixes a regression which caused the adapter to falsely return an empty 404 response, caused by an upstream change https://github.com/withastro/astro/pull/7754.
9 changes: 1 addition & 8 deletions packages/cloudflare/src/entrypoints/server.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ export function createExports(manifest: SSRManifest) {
return env.ASSETS.fetch(request);
}

let routeData = app.match(request, { matchNotFound: true });
if (routeData) {
let routeData = app.match(request);
Reflect.set(
request,
Symbol.for('astro.clientAddress'),
Expand All @@ -67,12 +66,6 @@ export function createExports(manifest: SSRManifest) {
}

return response;
}

return new Response(null, {
status: 404,
statusText: 'Not found',
});
};

return { default: { fetch } };
Expand Down
9 changes: 1 addition & 8 deletions packages/cloudflare/src/entrypoints/server.directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export function createExports(manifest: SSRManifest) {
return env.ASSETS.fetch(request);
}

let routeData = app.match(request, { matchNotFound: true });
if (routeData) {
let routeData = app.match(request);
Reflect.set(
request,
Symbol.for('astro.clientAddress'),
Expand All @@ -60,12 +59,6 @@ export function createExports(manifest: SSRManifest) {
}

return response;
}

return new Response(null, {
status: 404,
statusText: 'Not found',
});
};

return { onRequest, manifest };
Expand Down

0 comments on commit 5b62509

Please sign in to comment.