hackforla / VRMS

Volunteer Relationship Management System: This is an ambitious project to create a system that will help us measure our human capital development, reduce repetitive tasks and processes, and improve outcomes.
GNU Affero General Public License v3.0
40 stars 78 forks source link

Vite Build Issue #1767

Closed JackHaeg closed 1 week ago

JackHaeg commented 2 weeks ago

Overview

Currently the github action for the frontend rebuild is not working and needs to be investigated now that we have merged Vite. Until this issue is resolved, we cannot rebuild PROD or DEV

Action Items

Resources/Instructions

Error logs below

```sh Run kciter/aws-ecr-action@v3 /usr/bin/docker run --name d8d7f5fdd92fd8144d442da3d2c297dafe214a_bcb634 --label d8d7f5 --workdir /github/workspace --rm -e "AWS_SHARED_CLUSTER" -e "AWS_APP_NAME" -e "AWS_REGION" -e "DOCKERFILE" -e "DOCKER_PATH" -e "AWS_DEFAULT_REGION" -e "AWS_ACCESS_KEY_ID" -e "AWS_SECRET_ACCESS_KEY" -e "INPUT_ACCESS_KEY_ID" -e "INPUT_SECRET_ACCESS_KEY" -e "INPUT_ACCOUNT_ID" -e "INPUT_REPO" -e "INPUT_REGION" -e "INPUT_TAGS" -e "INPUT_DOCKERFILE" -e "INPUT_PATH" -e "INPUT_ASSUME_ROLE" -e "INPUT_CREATE_REPO" -e "INPUT_SET_REPO_POLICY" -e "INPUT_REPO_POLICY_FILE" -e "INPUT_EXTRA_BUILD_ARGS" -e "INPUT_PREBUILD_SCRIPT" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/VRMS/VRMS":"/github/workspace" d8d7f5:fdd92fd8144d442da3d2c297dafe214a == START LOGIN WARNING! Using --password via the CLI is insecure. Use --password-stdin. WARNING! Your password will be stored unencrypted in /github/home/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded == FINISHED LOGIN == START DOCKERIZE #1 [internal] load build definition from Dockerfile.prod #1 transferring dockerfile: 771B done #1 DONE 0.0s #3 [internal] load metadata for docker.io/library/node:20-alpine #3 DONE 0.0s #4 [internal] load metadata for docker.io/library/node:18-slim #4 ... #2 [internal] load metadata for docker.io/library/nginx:latest #2 DONE 0.4s #4 [internal] load metadata for docker.io/library/node:18-slim #4 DONE 0.4s #5 [internal] load .dockerignore #5 transferring context: 125B done #5 DONE 0.0s #12 [node-modules-install 1/6] FROM docker.io/library/node:20-alpine #12 DONE 0.0s #16 [internal] load build context #16 transferring context: 3.11MB 0.0s done #16 DONE 0.1s #19 [client-production 1/3] FROM docker.io/library/nginx:latest@sha256:b5d3f... #19 resolve docker.io/library/nginx:latest@sha256:b5d3f3e104699f0768e5ca8626914c16e52647943c65274d8a9e63072bd015bb 0.0s done #19 sha256:9527c0f683c3b2f0465019f9f5456f01a0fc0d4d274466831b9910a21d0302cd 7.47kB / 7.47kB done #19 ... #20 [node-modules-install 2/6] RUN mkdir /srv/client && chown node:node /srv... #20 DONE 0.2s #19 [client-production 1/3] FROM docker.io/library/nginx:latest@sha256:b5d3f... #19 sha256:b5d3f3e104699f0768e5ca8626914c16e52647943c65274d8a9e63072bd015bb 10.27kB / 10.27kB done #19 sha256:10b61fc3d8262c8bf44c89aef3d81202ce12b8cba12fff2e32ca5978a2d88c2b 2.29kB / 2.29kB done #19 sha256:302e3ee498053a7b5332ac79e8efebec16e900289fc1ecd1c754ce8fa047fcab 11.53MB / 29.13MB 0.2s #19 ... #10 [node-modules-install 3/6] WORKDIR /srv/client #10 DONE 0.0s #19 [client-production 1/3] FROM docker.io/library/nginx:latest@sha256:b5d3f... #19 sha256:cd986b3703ae056a0ba06e883b07848db7a08681864a2ca96849670[23](https://github.com/hackforla/VRMS/actions/runs/11039243780/job/30889297184#step:8:24)0d25b2b 0B / 41.88MB 0.3s #19 ... #9 [node-modules-install 4/6] RUN mkdir -p node_modules #9 DONE 0.2s #8 [node-modules-install 5/6] COPY --chown=node:node package.json package.j... #8 DONE 0.1s #19 [client-production 1/3] FROM docker.io/library/nginx:latest@sha256:b5d3f... #19 sha256:302e3ee498053a7b5332ac79e8efebec16e900289fc1ecd1c754ce8fa047fcab 29.13MB / 29.13MB 0.4s done #19 sha256:cd986b3703ae056a0ba06e883b07848db7a08681864a2ca96849670230d25b2b 13.63MB / 41.88MB 0.4s #19 sha256:cd986b3703ae056a0ba06e883b07848db7a08681864a2ca96849670230d25b2b 31.79MB / 41.88MB 0.5s #19 sha256:34a52cbc3961ba3b2d424f040554938ea89e8094f629441405348a9030d89999 629B / 629B 0.5s done #19 sha256:d1875670ac8aafd9b7a00cdaa081e296955ed186616d04f4974c9cedaa21b331 0B / 954B 0.5s #19 sha256:cd986b3703ae056a0ba06e883b07848db7a08681864a2ca96849670230d25b2b 41.88MB / 41.88MB 0.6s done #19 sha256:d1875670ac8aafd9b7a00cdaa081e296955ed186616d04f4974c9cedaa21b331 954B / 954B 0.6s done #19 sha256:97182578e5ec1388c464990f781f56a4264379cfa3a621f15fb28831c848cd63 0B / 1.21kB 0.6s #19 sha256:af17adb1bdcc43b1306f84a35848fe299f204328a28a1d307b4219edb02cd888 0B / 393B 0.6s #19 sha256:97182578e5ec1388c464990f781f56a4264379cfa3a621f15fb28831c848cd63 1.21kB / 1.21kB 0.6s done #19 sha256:af17adb1bdcc43b1306f84a35848fe299f204328a28a1d307b4219edb02cd888 393B / 393B 0.6s done #19 sha256:67b9310357e1d8cc6aa835063af4579da53d6322e777a9890418b12c7b2d9080 1.40kB / 1.40kB 0.7s done #19 extracting sha256:302e3ee498053a7b5332ac79e8efebec16e900289fc1ecd1c754ce8fa047fcab 0.7s #19 extracting sha256:cd986b3703ae056a0ba06e883b07848db7a08681864a2ca96849670230d25b2b #19 extracting sha256:cd986b3703ae056a0ba06e883b07848db7a08681864a2ca96849670230d25b2b 0.8s done #19 extracting sha256:34a52cbc3961ba3b2d424f040554938ea89e8094f629441405348a9030d89999 done #19 extracting sha256:d1875670ac8aafd9b7a00cdaa081e296955ed186616d04f4974c9cedaa21b331 done #19 extracting sha256:af17adb1bdcc43b1306f84a35848fe299f204328a28a1d307b4219edb02cd888 done #19 extracting sha256:97182578e5ec1388c464990f781f56a4264379cfa3a621f15fb28831c848cd63 done #19 extracting sha256:67b9310357e1d8cc6aa835063af4579da53d6322e777a9890418b12c7b2d9080 done #19 DONE 2.8s #14 [client-builder 1/5] FROM docker.io/library/node:18-slim@sha256:2614141a... #14 resolve docker.io/library/node:18-slim@sha256:2614141afa1840a5a96a6a97da02c98f829dc1db18ea3357a08b8f0574dd47bb done #14 sha256:2614141afa1840a5a96a6a97da02c98f829dc1db18ea3357a08b8f0574dd47bb 6.49kB / 6.49kB done #14 sha256:c5ebdabc7be8c4a6e8e22a399ad7cce25bf761b3c564b6d8bbd81dcfd560a595 1.93kB / 1.93kB done #14 sha256:479dd785b58540106c1efa542fbc1201975e111c20d01271004f934d4b7b6785 6.86kB / 6.86kB done #14 sha256:302e3ee498053a7b5332ac79e8efebec16e900289fc1ecd1c754ce8fa047fcab 29.13MB / 29.13MB 0.4s done #14 sha256:f4523b1e34854ab7c1ddd9d96bb54d9c7b65bab1f8b8dd7290cea456ef8b70ab 3.31kB / 3.31kB 0.1s done #14 sha256:643a6ed41aefb13e18365e9b0f766923bdda1dd7aa1b0cfe574ed68cbe3269f8 38.18MB / 38.18MB 0.6s done #14 sha256:23663f1b133693fd2fab8b13dbb66a9648a894d6599b61feead7b33a6a055c4a 1.71MB / 1.71MB 0.2s done #14 sha256:2fad2dcef2d4f05fa2c0b7526f786ec78f2dd8ebaeaa9e8bb27d48cd2b10c3ec 444B / 444B 0.2s done #14 extracting sha256:302e3ee498053a7b5332ac79e8efebec16e900289fc1ecd1c754ce8fa047fcab 1.0s done #14 extracting sha256:f4523b1e34854ab7c1ddd9d96bb54d9c7b65bab1f8b8dd7290cea456ef8b70ab done #14 extracting sha256:643a6ed41aefb13e18365e9b0f766923bdda1dd7aa1b0cfe574ed68cbe3269f8 1.1s #14 ... #15 [client-production 2/3] COPY /nginx/default.conf /etc/nginx/conf.d/defau... #15 DONE 0.0s #14 [client-builder 1/5] FROM docker.io/library/node:18-slim@sha256:2614141a... #14 extracting sha256:643a6ed41aefb13e18365e9b0f766923bdda1dd7aa1b0cfe574ed68cbe3269f8 1.2s done #14 extracting sha256:23663f1b133693fd2fab8b13dbb66a9648a894d6599b61feead7b33a6a055c4a 0.0s done #14 extracting sha256:2fad2dcef2d4f05fa2c0b7526f786ec78f2dd8ebaeaa9e8bb27d48cd2b10c3ec done #14 DONE 3.0s #7 [node-modules-install 6/6] RUN npm install --no-update-notifier #7 ... #13 [client-builder 2/5] WORKDIR /srv/client #13 DONE 0.0s #7 [node-modules-install 6/6] RUN npm install --no-update-notifier #7 30.11 npm warn EBADENGINE Unsupported engine { #7 30.11 npm warn EBADENGINE package: 'vrms-client@0.3.0', #7 30.11 npm warn EBADENGINE required: { node: '<=18.0.0' }, #7 30.11 npm warn EBADENGINE current: { node: 'v20.17.0', npm: '10.8.2' } #7 30.11 npm warn EBADENGINE } #7 32.15 npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. #7 32.21 npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported #7 32.59 npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported #7 33.10 npm warn deprecated @humanwhocodes/config-array@0.5.0: Use @eslint/config-array instead #7 33.20 npm warn deprecated @humanwhocodes/object-schema@1.2.1: Use @eslint/object-schema instead #7 33.53 npm warn deprecated babel-preset-es2015@6.[24](https://github.com/hackforla/VRMS/actions/runs/11039243780/job/30889297184#step:8:25).1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update! #7 37.73 npm warn deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. #7 46.58 #7 46.58 added 7[27](https://github.com/hackforla/VRMS/actions/runs/11039243780/job/30889297184#step:8:28) packages, and audited 728 packages in 40s #7 46.58 #7 46.58 161 packages are looking for funding #7 46.58 run `npm fund` for details #7 46.61 #7 46.61 45 vulnerabilities (10 high, 35 critical) #7 46.61 #7 46.61 To address issues that do not require attention, run: #7 46.61 npm audit fix #7 46.61 #7 46.61 To address all issues possible (including breaking changes), run: #7 46.61 npm audit fix --force #7 46.61 #7 46.61 Some issues need review, and may require choosing #7 46.61 a different dependency. #7 46.61 #7 46.61 Run `npm audit` for details. #7 DONE 47.5s #6 [client-builder 3/5] COPY --from=node-modules-install /srv/client/node_m... #6 DONE 8.7s #17 [client-builder 4/5] COPY . . #17 DONE 0.0s #11 [client-builder 5/5] RUN npm run build #11 0.437 #11 0.437 > vrms-client@0.3.0 build #11 0.437 > vite build #11 0.437 #11 0.649 failed to load config from /srv/client/vite.config.js #11 0.653 error during build: #11 0.653 Error: Failed to load native binding #11 0.653 at Object. (/srv/client/node_modules/@swc/core/binding.js:333:11) #11 0.653 at Module._compile (node:internal/modules/cjs/loader:1364:14) #11 0.653 at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) #11 0.653 at _require.extensions. [as .js] (file:///srv/client/node_modules/vite/dist/node/chunks/dep-b[28](https://github.com/hackforla/VRMS/actions/runs/11039243780/job/30889297184#step:8:29)90f90.js:66362:17) #11 0.653 at Module.load (node:internal/modules/cjs/loader:1203:32) #11 0.653 at Module._load (node:internal/modules/cjs/loader:1019:12) #11 0.653 at Module.require (node:internal/modules/cjs/loader:12[31](https://github.com/hackforla/VRMS/actions/runs/11039243780/job/30889297184#step:8:32):19) #11 0.653 at require (node:internal/modules/helpers:177:18) #11 0.653 at Object. (/srv/client/node_modules/@swc/core/index.js:49:17) #11 0.653 at Module._compile (node:internal/modules/cjs/loader:1[36](https://github.com/hackforla/VRMS/actions/runs/11039243780/job/30889297184#step:8:37)4:14) #11 0.661 npm notice #11 0.661 npm notice New minor version of npm available! 10.7.0 -> 10.8.3 #11 0.661 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3 #11 0.661 npm notice To update run: npm install -g npm@10.8.3 #11 0.661 npm notice #11 ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1 ------ > [client-builder 5/5] RUN npm run build: ------ process "/bin/sh -c npm run build" did not complete successfully: exit code: 1 ```
Chat GPT Explanation of issue The error you're seeing during the build process is likely related to a problem with the native bindings for the `@swc/core` package, which is a core dependency of Vite for transforming JavaScript and TypeScript files. Here’s a breakdown of the issue: 1. **Failed to load native binding**: The key error here is `Failed to load native binding`, which suggests that the package `@swc/core` is trying to use a native module (likely compiled code), and it’s unable to find or load it properly. This could happen due to: - Mismatched Node.js version. - Corrupted `node_modules` folder. - The native module isn't installed or built properly. 2. **Potential causes**: - **Incorrect Node.js version**: Sometimes native bindings depend on specific versions of Node.js. You can check if your current version of Node.js matches the version supported by `@swc/core`. - **Corrupt `node_modules`**: The installation of the module may have been corrupted. Deleting the `node_modules` folder and reinstalling the dependencies can help. - **Missing dependencies**: If certain system-level dependencies for compiling the native bindings are missing, the package might fail to load. ### How to fix it: 1. **Reinstall dependencies**: - Try removing the `node_modules` folder and reinstalling the dependencies. ```bash rm -rf node_modules npm install ``` 2. **Ensure Node.js compatibility**: - Check your Node.js version and make sure it’s compatible with the version of `@swc/core`. You can check your version by running: ```bash node -v ``` If necessary, upgrade or downgrade Node.js using a tool like `nvm`. 3. **Update `@swc/core`**: - You might want to ensure you're using a compatible or latest version of `@swc/core` by running: ```bash npm install @swc/core ``` 4. **Rebuild native bindings**: - If the problem persists, try forcing a rebuild of native bindings: ```bash npm rebuild @swc/core ``` 5. **Clear npm cache** (if nothing else works): - Sometimes npm cache issues can cause build problems: ```bash npm cache clean --force ``` Once you've done the above steps, retry the build: ```bash npm run build ``` Let me know if this resolves the issue or if you're still encountering problems!
trillium commented 2 weeks ago

Updated issue with stack trace and ChatGPT read on the problem.

trillium commented 1 week ago
image

So building from the vite branch is also not working. Meaning we can't revert to earlier versions of the vite branch changes in order to resolve this issue.

trillium commented 1 week ago

RESOLVED

ryanfchase commented 1 week ago

@trillium @JackHaeg Hi all -- the 311-Data project is about to undergo a Vite migration from Webpack. Bonnie mentioned that your team ran into a blocker related to the merge. I've looked at the description for #1775, and I've reviewed the Files Changed... is there a write-up on what the build issue was and how this PR addressed it?

Happy to schedule a meeting if that's easier. Our dev team is just looking for further resources to make sure we don't run into any hiccups with our migration.

trillium commented 5 days ago

Hey @ryanfchase, a write-up is a great idea.

The short version:

Prior to migrating to Vite we had a working build system, then maybe 2-3 weeks ago it started failing.

ryanfchase commented 1 day ago

Hey @ryanfchase, a write-up is a great idea.

The short version:

  • Build pipeline was working when we migrated to vite
  • VRMS doesn't currently do a continuous build
  • Manually triggered rebuild recently and the build failed, citing that then npm build couldn't locate vite.config.js
  • Migrated to vite.config.mjs, no change
  • Saw a warning in the build system that npm had an updated version available

    • Didn't know how to upgrade npm within a docker container
  • Tried moving to a newer starting docker container. Not sure the technical term.

    • Moved from node-18:slim to node-20:alpine in client/Dockerfile.prod and that resolved our problem

Prior to migrating to Vite we had a working build system, then maybe 2-3 weeks ago it started failing.

Thank you! That's very insightful -- I've mentioned this in our migration ticket. We don't use docker to manage our frontend build, but we do have a CI pipeline through Github Actions. We'll have a look there to make sure we don't encounter a similar problem.