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

RSC: process is not the real process object #33122

Closed
mohsen1 opened this issue Jan 10, 2022 · 4 comments
Closed

RSC: process is not the real process object #33122

mohsen1 opened this issue Jan 10, 2022 · 4 comments
Labels
bug Issue was opened via the bug report template.

Comments

@mohsen1
Copy link
Contributor

mohsen1 commented Jan 10, 2022

Environment info

Run next info (available from version 12.0.8 and up)

I think 12.0.8 is not published...

npm i next@12.0.8                          
npm ERR! code ETARGET
npm ERR! notarget No matching version found for next@12.0.8.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:

What version of Next.js are you using?

^12.0.8-canary.11

What version of Node.js are you using?

12

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

N/A

I believe I'm getting Webpack's fake process module when requiring process (require("process")) and process global object contains only the env object.

Expected Behavior

I'm expecting the real process in server components.

To Reproduce

In a server component try to print process.version for instance

// test.server.js

export default () => <p>{process.version}</p>
@mohsen1 mohsen1 added the bug Issue was opened via the bug report template. label Jan 10, 2022
@balazsorban44
Copy link
Member

Just curious, what's your use case @mohsen1?

@mohsen1
Copy link
Contributor Author

mohsen1 commented Jan 11, 2022

Many packages examine the process object to detect if they are in the server vs. client mode. In my case Prisma Client thinks I'm running the code in browser.

@huozhi
Copy link
Member

huozhi commented Feb 3, 2022

It's pretty related to the runtime so far. Til now (the time I commnent) it's running on the edge (a web like runtime) if you're using RSC with next.js. So it uses a browser polyfilled one. After bringing nodejs runtime into RSC, the process could be the nodejs runtime process.

Hope this answers your question.

@huozhi huozhi closed this as completed Jul 26, 2022
@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 Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants