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

Import error when using the action in a workflow #101

Closed
joukosaastamoinen opened this issue Sep 29, 2022 · 15 comments · Fixed by #103 or keylime/keylime#1120
Closed

Import error when using the action in a workflow #101

joukosaastamoinen opened this issue Sep 29, 2022 · 15 comments · Fixed by #103 or keylime/keylime#1120

Comments

@joukosaastamoinen
Copy link

Hey! Our team has been enjoying this action for a long time now, but today we started getting this error:

internal/modules/cjs/loader.js:1216
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /node_modules/@octokit/graphql/index.js
require() of ES modules is not supported.
require() of /node_modules/@octokit/graphql/index.js from /node_modules/@actions/github/lib/github.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /node_modules/@octokit/graphql/package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1216:13)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (/node_modules/@actions/github/lib/github.js:14:19)
    at Module._compile (internal/modules/cjs/loader.js:1200:[30](https://github.com/creditornot/ops-tools/actions/runs/3150609247/jobs/5123593663#step:3:31))
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:[32](https://github.com/creditornot/ops-tools/actions/runs/3150609247/jobs/5123593663#step:3:33))
    at Function.Module._load (internal/modules/cjs/loader.js:9[37](https://github.com/creditornot/ops-tools/actions/runs/3150609247/jobs/5123593663#step:3:38):14) {
  code: 'ERR_REQUIRE_ESM'
}
@manuelhenke
Copy link

Got the same issue here:
https://github.com/manuelhenke/nuxt-envalid/actions/runs/3150929118/jobs/5124272833

@remisture
Copy link

Happens for me as well.

name: Greetings

on: [pull_request_target]

jobs:
    greeting:
        runs-on: ubuntu-latest
        permissions:
            issues: write
            pull-requests: write
        if: ${{ github.actor != 'dependabot[bot]' }}
        steps:
            - uses: actions/first-interaction@v1
              with:
                  repo-token: ${{ secrets.GITHUB_TOKEN }}
                  pr-message: 'Gratulerer med din første PR!'

@andreamari
Copy link

Same problem, since yesterday.
These are our settings:
https://github.com/unitaryfund/mitiq/blob/master/.github/workflows/greeting.yml

@MCWertGaming
Copy link

Have the same problem with the default workflow configuration

@mikecentola
Copy link

Just noticed the problem for one of my repos as well.

@pony012
Copy link

pony012 commented Sep 29, 2022

If the action is non-blocking for your repo, you can use jobs.<job_id>.steps[*].continue-on-error:

name: Greetings

on: [pull_request_target]

jobs:
    greeting:
        runs-on: ubuntu-latest
        permissions:
            issues: write
            pull-requests: write
        if: ${{ github.actor != 'dependabot[bot]' }}
        steps:
            - uses: actions/first-interaction@v1
              continue-on-error: true
              with:
                  repo-token: ${{ secrets.GITHUB_TOKEN }}
                  pr-message: 'Something'

@alexbbt
Copy link

alexbbt commented Sep 29, 2022

This action should be using release tags so that we can lock to a working version. The continue-on-error workaround is a good short-term solution.

@wabscale
Copy link

Same here with default configuration.

MartinNemi03 added a commit to SkyCryptWebsite/SkyCrypt that referenced this issue Sep 30, 2022
Based on workaround from this issue: actions/first-interaction#101
jouni added a commit to vaadin/docs that referenced this issue Sep 30, 2022
tenthirtyam added a commit to vmware/power-validated-solutions-for-cloud-foundation that referenced this issue Sep 30, 2022
Comments out the `first-interaction` step due to a known issue that has been seen in `actions/first-interaction#v1`.

actions/first-interaction#101

Signed-off-by: Ryan Johnson <johnsonryan@vmware.com>
pllim added a commit to astropy/astropy that referenced this issue Sep 30, 2022
actions/first-interaction#101

This should be reverted when upstream is fixed.

[ci skip]
GaryJBlake pushed a commit to vmware/power-validated-solutions-for-cloud-foundation that referenced this issue Sep 30, 2022
Comments out the `first-interaction` step due to a known issue that has been seen in `actions/first-interaction#v1`.

actions/first-interaction#101

Signed-off-by: Ryan Johnson <johnsonryan@vmware.com>
@farayolaj
Copy link

Just made a PR to fix this. But I don't know who is supposed to review it.

@FanJups
Copy link

FanJups commented Oct 2, 2022

same here osscameroon/js-generator#137

It looks like it fails when I (as owner) open an issue, only me. That's weird!

name: Greetings

on: [pull_request, issues]

jobs:
  greeting:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      issues: write
    steps:
    - uses: actions/first-interaction@v1
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        issue-message: 'Thanks for opening this issue 😊 ! We really appreciate your work. Happy Coding 🎉🎊 !'' first issue'
        pr-message: 'Thanks for opening this pull request 😊 ! We really appreciate your work. Happy Coding 🎉🎊 !'' first pull request'

FanJups added a commit to osscameroon/js-generator that referenced this issue Oct 2, 2022
fix: solve the first-interaction issue actions/first-interaction#101 by adding the condition
"continue-on-error: true" as it is suggested there : https://github.com/keploy/keploy/pull/182/files
nehagup pushed a commit to keploy/keploy that referenced this issue Oct 3, 2022
temp fixing the greetings action based on the suggestion provided here - actions/first-interaction#101 (comment)
Samyak2 added a commit to chaos-genius/chaos_genius that referenced this issue Oct 4, 2022
mpeters added a commit to mpeters/keylime that referenced this issue Oct 4, 2022
This works around a busted actions/first-interaction@v1 until it's fixed
actions/first-interaction#101

Even after it's fixed it's probably good to keep around just so it won't
block merges in the future.

Signed-off-by: Michael Peters <mpeters@redhat.com>
mpeters added a commit to mpeters/keylime that referenced this issue Oct 4, 2022
This works around a busted actions/first-interaction@v1 until it's fixed
actions/first-interaction#101

Even after it's fixed it's probably good to keep around just so it won't
block merges in the future.

Signed-off-by: Michael Peters <mpeters@redhat.com>
mpeters added a commit to keylime/keylime that referenced this issue Oct 4, 2022
This works around a busted actions/first-interaction@v1 until it's fixed
actions/first-interaction#101

Even after it's fixed it's probably good to keep around just so it won't
block merges in the future.

Signed-off-by: Michael Peters <mpeters@redhat.com>
@cory-miller
Copy link
Contributor

v1.1.1 of this action has been released with the change from #103. Reference to v1 has been updated to v1.1.1 as well.

@pllim
Copy link

pllim commented Oct 6, 2022

Thanks!

pllim added a commit to astropy/astropy that referenced this issue Oct 6, 2022
@zer0Kerbal
Copy link

very much appreciated!

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