-
Couldn't load subscription status.
- Fork 29.7k
Closed
Labels
RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked
Description
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: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000
Binaries:
Node: 16.20.0
npm: 8.19.4
Yarn: 1.22.19
pnpm: 8.4.0
Relevant Packages:
next: 13.4.20-canary.6
eslint-config-next: 13.4.19
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
Next.js Config:
output: N/AWhich area(s) of Next.js are affected? (leave empty if unsure)
Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/mansdahlstrom1/middleware-client-component-bug
To Reproduce
- Create new Next app
- Add middleware
- mark middleware as
server-onlywithimport "server-only";
Describe the Bug
When using middleware we expect the middleware to run server-side only and to be able to use features like Cookies etc. But we are not able to do this as Next seem to think that the middleware is running client side.
Expected Behavior
MIddleware can be marked as server-only. Server side only features work in middleware.ts file.
OR
Clearer error message that explains the real error.
Which browser are you using? (if relevant)
116.0.5845.110
How are you deploying your application? (if relevant)
No response
sdelano and samtgarson
Metadata
Metadata
Assignees
Labels
RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked