firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.03k stars 943 forks source link

dynamic routes in app dir in nextjs13 not working #5522

Closed RajendraAVerma closed 1 year ago

RajendraAVerma commented 1 year ago

[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 thenfirebase 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.

nerder commented 1 year ago

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

dominicdev commented 1 year ago

any update?

AmritpalChera commented 1 year ago

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

post

onurhan1337 commented 1 year ago

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.