Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: 404 page doesn't work in cloudflare pages #1527

Closed
2 tasks done
huseeiin opened this issue Jun 5, 2024 · 2 comments
Closed
2 tasks done

[Bug?]: 404 page doesn't work in cloudflare pages #1527

huseeiin opened this issue Jun 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@huseeiin
Copy link
Contributor

huseeiin commented Jun 5, 2024

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

going to a page that doesn't exist in cloudflare pages shows a blank page with a Uncaught (in promise) Error: Context is not available error in the browser console

Expected behavior 🤔

for [...404].tsx to render correctly

Steps to reproduce 🕹

Steps:

1.create a solid start project
2.wrangler pages deploy dist
3.go to /page-that-doesnt-exist
4.empty page

Context 🔦

No response

Your environment 🌎

No response

@huseeiin huseeiin added the bug Something isn't working label Jun 5, 2024
@Brendonovich
Copy link
Contributor

Brendonovich commented Jun 8, 2024

Add unenv as a dependency, add the nodejs_compat compatability flag to your pages project, and put this in your config:

import { defineConfig } from "@solidjs/start/config";
import { cloudflare } from "unenv";

export default defineConfig({
  server: {
    preset: "cloudflare-pages",
    unenv: cloudflare,
  },
});

I think this will be done as part of the cloudflare preset at some point: nitrojs/nitro#1943

@huseeiin
Copy link
Contributor Author

nodejs_compat

worked! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants