Next.js 13 next build is not generated dynamic route

52 views Asked by At

I'm using Next 13 for client-side only, and deploying it to AWS CloudFront.

The file structure

├── app
│   ├── admin
│   │   ├── layout.tsx
│   │   ├── page.tsx
│   │   └── users
│   │       ├── [id]
│   │       │   ├── Profile.tsx
│   │       │   └── page.tsx
│   │       └── professional
│   │           └── page.tsx

When I run next build, here's my output

├── 404
│   └── index.html
├── 404.html
├── _next
│   ├── jFju-zHfE2iV1N6bkUU8C
│   └── static
│       ├── chunks
│       │   ├── 9677-452303365d7463ea.js
│       │   ├── app
│       │   │   ├── admin
│       │   │   │   ├── layout-915eb8775e574cbd.js
│       │   │   │   ├── page-e868f06261a2f88b.js
│       │   │   │   └── users
│       │   │   │       ├── [id]
│       │   │   │       │   └── page-9fb4202d62ac5e1b.js
│       │   │   │       └── professional
│       │   │   │           └── page-b3b18f1912c216cf.js
├── admin
│   ├── index.html
│   ├── index.txt
│   └── users
│       └── professional
│           ├── index.html
│           └── index.txt

I would expect to have admin/users/[id]/index.html, but I don't see that.

When I trying to access the page, I got this error

<Error>
  <Code>NoSuchKey</Code>
  <Message>The specified key does not exist.</Message>
  <Key>admin/users/[id]/index.html</Key>
  <RequestId>MSCR1A9FDQN0MWF0</RequestId>
  <HostId>jc368PO6hqkNti7K6OOCVOeQ+hvtnL/ajdbi5JdC6KpmoFVDx0XEb3qJMhP/PVQRlISMZ8gX2v8=. </HostId>
</Error>

My next.config.js

const nextConfig = {
  output: "export",
  trailingSlash: true,
  images: {
    unoptimized: true
  },
  webpack: (config, { isServer }) => {
    config.externals.push({
      "utf-8-validate": "commonjs utf-8-validate",
      bufferutil: "commonjs bufferutil",
    });
    return config;
  }
}

Any ideas on how I can fix it?

0

There are 0 answers