Skip to content

dynamic routes in app dir in nextjs13 not working #5522

Closed

Description

@RajendraAVerma

[REQUIRED] Environment info

firebase-tools: 11.23.0

Platform: Window

[REQUIRED] Test case

I am using NextJs 13 with experimental feature of "appDir"
while deploying to firebase hosting, dynamic routes become static path.
for example :
path app/[slug]/page.jsx become http://example.web.app/[slug]

ss

You can see [slug] is consider as static page

[REQUIRED] Steps to reproduce

  1. create nextjs13 app npx create-next-app@latest --experimental-app
  2. create app/[slug]/page.jsx.
  3. enable firebase experiments:enable webframeworks
  4. make sure to enable billing.
  5. firebase init hosting then firebase deploy
  6. after successfully deployment, check http://your-domain.web.app/hello, you will see page not found but http://example.web.app/[slug] is working.

in firebase.json

{
  "hosting": {
    "source": ".",
    "cleanUrls": false,
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

in next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    appDir: true,
  },
}

module.exports = nextConfig

in jsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"]
    }
  }
}

[REQUIRED] Expected behavior

It should generate dynamic routes.

[REQUIRED] Actual behavior

Dynamic routes not generated.

Activity

  1. nerder commented on Mar 21, 2023

    @nerder

    Any update on this issue? Is Next13 actually supported as of now?

  2. dominicdev commented on Apr 25, 2023

    @dominicdev

    any update?

  3. AmritpalChera commented on Apr 27, 2023

    @AmritpalChera

    Hey, instead of creating a file called [slug].tsx or smt. Make a folder called [slug] in the app directory (experimental setup):

    post

    • page.tsx
    • [slug]/page.tsx
  4. onurhan1337 commented on Aug 28, 2023

    @onurhan1337

    Is there an update? It's working, but I get a 404 error when I refresh the page. I searched for a solution but couldn't find one. Additionally, when copying the URL and sharing it with someone they click and get the same 404 error.

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