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

Any way to fix event.json cannot found issue when I run pnpm install in CodeBuild? #127

Closed
roger-qi-chen opened this issue Mar 1, 2023 · 5 comments

Comments

@roger-qi-chen
Copy link

Hi guys, I got this error when I run pnpm install in CodeBuild. Seems that pnpm cannot found the GitHub event.json when install.
Is there any way to fix or ignore this?
Cheers!

113 | [Container] 2023/03/01 04:59:07 Running command pnpm install
114 | node:fs:585
115 | handleErrorFromBinding(ctx);
116 | ^
117 |  
118 | Error: ENOENT: no such file or directory, open '/home/runner/work/_temp/_github_workflow/event.json'
119 | at Object.openSync (node:fs:585:3)
120 | at Object.readFileSync (node:fs:453:35)
121 | at NodeFS.readFileSync (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:84834:28)
122 | at NodeFS.readJsonSync (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:84171:30)
123 | at ../node_modules/.pnpm/@yarnpkg+core@4.0.0-rc.39_typanion@3.12.1/node_modules/@yarnpkg/core/lib/Configuration.js (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:160610:117)
124 | at __require (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:12:50)
125 | at ../node_modules/.pnpm/@yarnpkg+core@4.0.0-rc.39_typanion@3.12.1/node_modules/@yarnpkg/core/lib/execUtils.js (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:161970:27)
126 | at __require (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:12:50)
127 | at ../node_modules/.pnpm/@yarnpkg+core@4.0.0-rc.39_typanion@3.12.1/node_modules/@yarnpkg/core/lib/index.js (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:174430:43)
128 | at __require (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:12:50) {
129 | errno: -2,
130 | syscall: 'open',
131 | code: 'ENOENT',
132 | path: '/home/runner/work/_temp/_github_workflow/event.json'
133 | }
134 |  
135 | [Container] 2023/03/01 04:59:07 Command did not exit successfully pnpm install exit status 1
136 | [Container] 2023/03/01 04:59:07 Phase complete: BUILD State: FAILED
137 | [Container] 2023/03/01 04:59:07 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: pnpm install. Reason: exit status 1

image

@taoyong-ty
Copy link
Contributor

I am not familiar with pnpm. could you check if this helps? https://github.com/pnpm/pnpm.github.io/issues/296

@yiyang-ampup
Copy link

same issue.

I am converting the trigger from a Lambda function to a Github Action. Both are calling the exact same Codebuild project. But Lambda calling works, Github Action calling will result in this node:fs / event.json not found error.

The only difference seems to be Github Action > aws-codebuild-run-build@v1 is passing a lot of GITHUB_* variables. The particular file that is causing trouble seems to be GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json

Is there a way to NOT pass all the GITHUB_* variables?

@taoyong-ty
Copy link
Contributor

Hi @yiyang-ampup, Thanks for the finding.

This is expected behavior today. According to the specs,

env-vars-for-codebuild (optional) : A comma-separated list of the names of environment variables that the action passes from GitHub Actions to CodeBuild.

The action passes these environment variables to CodeBuild along with any environment variables that have a github prefix.

This list is often the same or a subset of the list of environment variables that you define for GitHub actions in the env property.

Note: If you specify an environment variable with the same name as one defined in your CodeBuild project, the one defined here replaces the one in the CodeBuild project. For a list of CodeBuild environment variables, see

Is there a way to NOT pass all the GITHUB_* variables?

No. But we can introduce a new disable-github-env-vars option, and update this code block accordingly. We've made a change made for a similar requirement before.

Your contributions via a. pull request will be much appreciated https://github.com/aws-actions/aws-codebuild-run-build/blob/main/CONTRIBUTING.md

@rstuhlmuller
Copy link

rstuhlmuller commented Aug 31, 2023

I am experiencing the same issue. When I run manually in the Codebuild console with the same sha, this error does not occur. I am not changing the buildspec or doing any manual changes. Commenting to follow this issue.

Error: ENOENT: no such file or directory, open '/home/runner/work/_temp/_github_workflow/event.json'
    at Object.openSync (node:fs:590:3)
    at Object.readFileSync (node:fs:458:35)
    at NodeFS.readFileSync (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:8[50](https://github.com/AviatrixIT/selfservice_ui/actions/runs/6054956832/job/16433179052#step:3:51)60:28)
    at NodeFS.readJsonSync (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:84397:30)
    at ../node_modules/.pnpm/@yarnpkg+core@4.0.0-rc.45_typanion@3.14.0/node_modules/@yarnpkg/core/lib/Configuration.js (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:159728:117)
    at __require (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:12:50)
    at ../node_modules/.pnpm/@yarnpkg+core@4.0.0-rc.45_typanion@3.14.0/node_modules/@yarnpkg/core/lib/execUtils.js (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:161103:27)
    at __require (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:12:50)
    at ../node_modules/.pnpm/@yarnpkg+core@4.0.0-rc.45_typanion@3.14.0/node_modules/@yarnpkg/core/lib/index.js (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:1740[55](https://github.com/AviatrixIT/selfservice_ui/actions/runs/6054956832/job/16433179052#step:3:56):43)
    at __require (/usr/local/lib/node_modules/pnpm/dist/pnpm.cjs:12:50) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/runner/work/_temp/_github_workflow/event.json'
}

@taoyong-ty
Copy link
Contributor

@vitulrana has addressed this feature request.

see: #142

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

No branches or pull requests

4 participants