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

On-Demand Revalidation not working if Server Actions are used #51504

Open
1 task done
patshologram opened this issue Jun 19, 2023 · 3 comments
Open
1 task done

On-Demand Revalidation not working if Server Actions are used #51504

patshologram opened this issue Jun 19, 2023 · 3 comments
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template. Output (export/standalone) Related to the the output option in `next.config.js`.

Comments

@patshologram
Copy link

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.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.16.0
      npm: 9.6.7
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.4.6
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 4.9.5

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Standalone mode (output: "standalone")

Link to the code that reproduces this issue or a replay of the bug

https://github.com/patshologram/revalidation-with-server-actions.git

To Reproduce

  1. clone the provided project
  2. install the dependencies via yarn
  3. built the standalone server via yarn build
  4. start the standalone server via node .next/standalone/server.js
  5. execute http://localhost:3000/api/revalidate

Side-Note: I've tried to reproduce this with 13.4.7-canary.1 but I get the following exception with the latest canary

❯ node .next/standalone/server.js
Listening on port 3000 url: http://localhost:3000
Error: connect ECONNREFUSED ::1:57906
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 57906
}
Error: connect ECONNREFUSED ::1:57906
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 57906
}

Describe the Bug

Upon revalidation, an exception is thrown

Revalidating static pages
Error: Invalid response 200
    at NextNodeServer.revalidate (/Users/martonpa/Sources/revalidation-with-server-actions/.next/standalone/node_modules/next/dist/server/next-server.js:1286:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Server.<anonymous> (/Users/martonpa/Sources/revalidation-with-server-actions/.next/standalone/node_modules/next/dist/server/lib/server-ipc/index.js:55:30)
Error revalidating Error: Failed to revalidate /: Invalid response 200
    at revalidate (/Users/martonpa/Sources/revalidation-with-server-actions/.next/standalone/node_modules/next/dist/server/api-utils/node.js:387:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handler (/Users/martonpa/Sources/revalidation-with-server-actions/.next/standalone/.next/server/pages/api/revalidate.js:18:9)

Removing the serverActions: true from nextjs.config.js and the use server from actions.ts leads to a working revalidation.

Expected Behavior

On-Demand Revalidation should work despite the activated Server Actions.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

EC2 Instance

@patshologram patshologram added the bug Issue was opened via the bug report template. label Jun 19, 2023
@github-actions github-actions bot added area: app App directory (appDir: true) Output (export/standalone) Related to the the output option in `next.config.js`. labels Jun 19, 2023
@patshologram
Copy link
Author

@quinm0
Copy link

quinm0 commented Jul 5, 2023

@patshologram does this crash your browser when you run it? If so I'm seeing the same issue

@AeroWang
Copy link

AeroWang commented Jul 28, 2023

It seems to be more than just output: standalone. On-Demand Revalidation not working if Server Actions are used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template. Output (export/standalone) Related to the the output option in `next.config.js`.
Projects
None yet
Development

No branches or pull requests

3 participants