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

Error! This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (6:7) /home/circleci/project/node_modules/@octokit/openapi-types/generated/types.ts #16

Closed
lili2311 opened this issue Dec 4, 2020 · 8 comments · Fixed by #45
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs

Comments

@lili2311
Copy link

lili2311 commented Dec 4, 2020

Description

I've started getting a failing pipeline (something changed upstream it seems) on a project that uses @oktokit/rest package. It started failing about 2 weeks ago.

The error references this package Error! This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (6:7) /home/circleci/project/node_modules/@octokit/openapi-types/generated/types.ts
I have tried downgrading the version of @oktokit/rest but still seeing the issue, perhaps I can't find the right version at which the package was introduced and many dependencies are not pinned so it is tricky to find.

The package lockfile is not published with you releases so we end up getting whatever is the latest version within the range and I think this is the issue really, would someone be able to confirm?

snyk-api-import@ snyk-api-import
├─┬ @octokit/rest@18.0.6 invalid
│ ├─┬ @octokit/core@3.2.2
│ │ ├─┬ @octokit/auth-token@2.4.4
│ │ │ └── @octokit/types@6.0.1 deduped
│ │ ├─┬ @octokit/graphql@4.5.8
│ │ │ ├── @octokit/request@5.4.11 deduped
│ │ │ ├── @octokit/types@6.0.1 deduped
│ │ │ └── universal-user-agent@6.0.0
│ │ ├─┬ @octokit/request@5.4.11
│ │ │ ├─┬ @octokit/endpoint@6.0.10
│ │ │ │ ├── @octokit/types@6.0.1 deduped
│ │ │ │ ├── is-plain-object@5.0.0 deduped
│ │ │ │ └── universal-user-agent@6.0.0
│ │ │ ├─┬ @octokit/request-error@2.0.4
│ │ │ │ ├── @octokit/types@6.0.1 deduped
│ │ │ │ ├── deprecation@2.3.1 deduped
│ │ │ │ └── once@1.4.0 deduped
│ │ │ ├── @octokit/types@6.0.1 deduped
│ │ │ ├── deprecation@2.3.1
│ │ │ ├── is-plain-object@5.0.0
│ │ │ ├── node-fetch@2.6.1
│ │ │ ├─┬ once@1.4.0
│ │ │ │ └── wrappy@1.0.2
│ │ │ └── universal-user-agent@6.0.0
│ │ ├─┬ @octokit/types@6.0.1
│ │ │ ├── @octokit/openapi-types@1.2.2
│ │ │ └── @types/node@12.19.8 deduped
│ │ ├── before-after-hook@2.1.0
│ │ └── universal-user-agent@6.0.0
│ ├── @octokit/plugin-paginate-rest@2.6.1 extraneous
│ ├── @octokit/plugin-request-log@1.0.2
│ └── @octokit/plugin-rest-endpoint-methods@4.2.0 extraneous
├─┬ @semantic-release/exec@5.0.0

More info

  • Repo: https://github.com/snyk-tech-services/snyk-api-import
  • Command: npx pkg . -t node12-linux-x64,node12-macos-x64,node12-win-x64
  • This package did not used to be there in the tree (locally I had a lockfile which did not have it and the pkg command succeeded, unfortunately I deleted it to make sure CI and local were in sync it so can't check the versions of the dependencies that last worked :(. Realised too late that I really needed that! And it was ignored in git 🤦 so no backups for me)

Full error

Error! This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (6:7)
  /home/circleci/project/node_modules/@octokit/openapi-types/generated/types.ts
    at makeError (/home/circleci/project/node_modules/@semantic-release/exec/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/home/circleci/project/node_modules/@semantic-release/exec/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async module.exports (/home/circleci/project/node_modules/@semantic-release/exec/lib/exec.js:16:11)
    at async prepare (/home/circleci/project/node_modules/@semantic-release/exec/index.js:54:5)
    at async validator (/home/circleci/project/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /home/circleci/project/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next (/home/circleci/project/node_modules/p-reduce/index.js:16:18) {
@gr2m
Copy link
Contributor

gr2m commented Dec 4, 2020

Hi Lili, thank you for submitting the issue.

Error! This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript'

I've never seen that error before. I assume it's coming from pkg, but I'll need some time to investigate

The package lockfile is not published with you releases so we end up getting whatever is the latest version within the range and I think this is the issue really, would someone be able to confirm?

The package lockfile is not meant to be published, if we did you'd have a much larger dependency tree, because npm would not be able to de-duplicate its sub dependencies. You wouldn't receive security updates, etc. This is by design, that's why we follow semantic versioning in order to avoid breaking things in fix/feature releases.

@gr2m gr2m added the Type: Support Any questions, information, or general needs around the SDK or GitHub APIs label Dec 4, 2020
@gr2m
Copy link
Contributor

gr2m commented Dec 5, 2020

I looked into it and pkg tries to import @octokit/openapi-types/generated/types.ts which it really shouldn't need to as it only contains type definitions. I don't know pkg well enough to understand what is going on here, but I do not think that ti's a problem with Octokit.

We started using @octokit/openapi-types.ts types recently, as we migrated to GitHub's OpenAPI spec. It's now imported by @octokit/types. There is no unusual change that could have triggered the problem you see, at least none that I can think of.

@marsousa
Copy link

marsousa commented Dec 8, 2020

This exact same issue (pkg + octokit) has also just started occurring to us, breaking our pipeline.
Since there are no new releases of pkg since Jun (4.4.9), I thought the problem would be related to this package. However, it seems to affect others not using octokit:
vercel/pkg#908
vercel/pkg#672
Unfortunately the solutions described there seem to be removing/updating the offending dependencies.

I have tried downgrading Octokit to 16.43.2 (which I knew worked with pkg@4.4.9 when building our previous release binary) but the issue persists :(

Deleting the file (node_modules/@octokit/openapi-types/generated/types.ts) right before packaging seems to solve it, but it's a bit hacky. This generates a warning when creating the package ("Warning Cannot find module '@octokit/openapi-types' from '/src'"), but everything seems to work normally with the binary.

@gr2m
Copy link
Contributor

gr2m commented Dec 8, 2020

the 2nd issue's comment says

problem solved after updating koa-mongo's mongodb dep version to ^3.2.3

Here is the changelog of this release: mongodb/node-mongodb-native@6d4f18b#diff-648afe3d986261d8f2015b2b131b0e4a448d4dc6946cfde1a7a836876cee255eR5

Maybe there is something in there that we can do to resolve the problem on our side? I don't have time to investigate myself I'm afraid

@aerben
Copy link

aerben commented Dec 22, 2020

We are running into this issue as well, also with octokit. And our solution is also just to delete the offending types.ts file, but this is not a long term solution.

@hipstersmoothie
Copy link
Contributor

I'm bumping into this issue now too in auto. The problem seems to be that this package specifies a TypeScript file for its main:

{
  "main": "generated/types.ts",
}

Adding a blank generated/types.js and setting main to that file fixes my problem. Would you accept a PR that makes this change?

@gr2m
Copy link
Contributor

gr2m commented Feb 3, 2021

Thanks for investigating, @hipstersmoothie! Let's do it

@gr2m gr2m closed this as completed in #45 Feb 3, 2021
@octokitbot
Copy link
Contributor

🎉 This issue has been resolved in version 4.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs
Projects
None yet
6 participants