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

Dynamic = 'error' throws exception on very simple static page #43059

Closed
1 task done
seeARMS opened this issue Nov 18, 2022 · 1 comment · Fixed by #43377
Closed
1 task done

Dynamic = 'error' throws exception on very simple static page #43059

seeARMS opened this issue Nov 18, 2022 · 1 comment · Fixed by #43377
Assignees
Labels
area: app App directory (appDir: true)

Comments

@seeARMS
Copy link

seeARMS commented Nov 18, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
Binaries:
  Node: 17.8.0
  npm: 8.19.2
  Yarn: 1.22.19
  pnpm: 7.16.1
Relevant packages:
  next: 13.0.4-canary.5
  eslint-config-next: 13.0.3
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

I have a freshly installed next@canary build (yarn create next-app --experimental-app).

I created a simple page with the following code (located in app/test/page.tsx):

export const dynamic = "error"

export default function Page() {
  return <div>Nice!</div>
}

When running yarn build, I get an exception:

Error occurred prerendering page "/test". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Page with dynamic = "error" encountered dynamic data method /test.
    at /Users/colinarms/src/nextplayground/test/node_modules/next/dist/export/worker.js:192:31
    at async Span.traceAsyncFn (/Users/colinarms/src/nextplayground/test/node_modules/next/dist/trace/trace.js:79:20)

This is a very simple static page with no dynamic fetches, so dynamic = 'error' shouldn't throw any exceptions.

Expected Behavior

The static page should get generated with no issue.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/seeARMS/nextjs-dynamic-repro

To Reproduce

  1. Git clone repo
  2. Run yarn build
  3. Exception occurs and build fails
@seeARMS seeARMS added the bug Issue was opened via the bug report template. label Nov 18, 2022
@balazsorban44 balazsorban44 added area: app App directory (appDir: true) kind: bug and removed bug Issue was opened via the bug report template. labels Nov 18, 2022
@hanneslund hanneslund self-assigned this Nov 25, 2022
ijjk pushed a commit that referenced this issue Nov 26, 2022
`export const dynamic = "error"` should only throw if the page actually
didn't get exported during `next build`. Test already exist to make sure
it throws:
`test/integration/app-dynamic-error/app/dynamic-error/page.js`

Fixes #43059

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
brvnonascimento pushed a commit to brvnonascimento/next.js that referenced this issue Nov 28, 2022
…el#43377)

`export const dynamic = "error"` should only throw if the page actually
didn't get exported during `next build`. Test already exist to make sure
it throws:
`test/integration/app-dynamic-error/app/dynamic-error/page.js`

Fixes vercel#43059

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: app App directory (appDir: true)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants