Skip to content

webframeworks experiment 404 handling incorrect #8035

Closed

Description

@MidnightLightning

When running a NextJS app using "App Routing" in a Firebase emulator, it doesn't handle 404 page generation properly. The default NextJS 404 page generates a "This page could not be found" error styled in the middle of the page. When running in Firebase Emulator suite, the 404 page generates as . This makes it impossible to test custom 404 page appearances for a NextJS application within the Firebase emulator.

[REQUIRED] Environment info

firebase-tools: 13.24.2

Platform: Docker running inside macOS

[REQUIRED] Test case

https://gitlab.com/MidnightLightning/firebase-404-test

[REQUIRED] Steps to reproduce

Run docker compose up, then visit http://localhost:25602/foobarbaz.

[REQUIRED] Expected behavior

To see the NextJS custom 404 page (text "This page could not be found" in the center of screen)

[REQUIRED] Actual behavior

A plain textual response of "Cannot GET /pathname"

Activity

  1. aalej commented on Dec 10, 2024

    @aalej
    Contributor

    Thanks for the detailed report, @MidnightLightning! I was able to reproduce the behavior you mentioned. From what I can gather, the issue only occurs on the emulator. When deploying the app to Firebase Hosting, accessing "https://<SITE_ID>.web.app/foobarbaz" shows the Next.js 404 page.

    I'll raise this to our engineering team and mark this as reproducible.

  2. MidnightLightning commented on Dec 13, 2024

    @MidnightLightning
    Author

    Agreed @aalej, this is a bug with the Emulator Suite, not with Firebase overall. A production deploy of a NextJS app using the webframeworks experiment handles 404 pages appropriately; I've only seen this issue in how the Emulator Suite mocks that functionality for local development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions