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

Just suddenly vite is causing some error in bitbucket.. I saw a fix for this but what about 5.4.14? #19260

Open
7 tasks done
rchancey opened this issue Jan 22, 2025 · 3 comments

Comments

@rchancey
Copy link

Describe the bug

I am using 5.4.14 and started getting this today . I have not compiled in 2 days .. there was some change 2 days ago that I saw someone do a fix for

This is on bitbucket.. .

pulling my hair out.. the little I have left..

error during build:

I am asking here since I saw someone had the same issue 2 days ago and made fix to the latest 6 branch. did it breaking something in 5?

TypeError: crypto$2.getRandomValues is not a function

at resolveConfig (file:///opt/atlassian/pipelines/agent/build/node_modules/vite/dist/node/chunks/dep-CHZK6zbr.js:66562:16)

at async build (file:///opt/atlassian/pipelines/agent/build/node_modules/vite/dist/node/chunks/dep-CHZK6zbr.js:65395:18)

at async CAC.<anonymous> (file:///opt/atlassian/pipelines/agent/build/node_modules/vite/dist/node/cli.js:829:5)

Failed to build.

Reproduction

This is a build time.. no way to reproduce for you to see. I did paste the error

Steps to reproduce

I ran a build on bitbucket .... after not coding for 2 days.. and suddenly it's throwing this error. Works fine local so not sure

System Info

"devDependencies": {
    "@types/react": "^18.2.56",
    "@types/react-dom": "^18.2.19",
    "@vitejs/plugin-react-swc": "^3.6.0",
    "eslint": "^8.56.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-plugin-import": "^2.30.0",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.5",
    "vite": "^5.4.14"
  }

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

sapphi-red commented Jan 22, 2025

That error would happen when crypto.getRandomValues is not supported. crypto.getRandomValues was added in Node 17.4, so if you are using a Node version that is lower than that, that error will happen.
But since Vite 5+ only supports Node 18, Node 20+, it shouldn't be a problem.
Maybe you had Vite 5 working on Node 17 which happened to work?

I need a public bitbucket repo that reproduces this to investigate further.

Copy link

Hello @rchancey. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@rchancey
Copy link
Author

Thanks for the comments. we are supposed to be on node 18. I will check with the build expert to verify. We have not changed that stuff in 10 months so I am just pasting this because 2 days ago the build was fine and I get back and vite is throwing this error.. and I saw some fix for something. I will get back on the node version and update if we are not at least on 18.. which is what we should be on. FROM --platform=linux/amd64 public.ecr.aws/sam/build-nodejs18.x:latest as builder. stay tuned! We are shut down until this is fixed :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants