auto icon indicating copy to clipboard operation
auto copied to clipboard

Release fails with `Error: fatal: ' 9007199254740991': not an integer`

Open aldrichdev opened this issue 2 years ago • 21 comments

Describe the bug

As of today, but not last Friday (2/16), our canary (PR) releases are failing on the shipit command, with the following error:

Error: fatal: ' 9007199254740991': not an integer

More detailed output using -vv option:

ℹ  info      Using command: 'shipit'
d8bc8a1c58153a82f743f9374e6233f8d24eed64
ℹ  info      Getting commits from HEAD^ to HEAD
7ec96633f5ae531094d20d2d2452924354eabc40
d8bc8a1c58153a82f743f9374e6233f8d24eed64
d8bc8a1c58153a82f743f9374e6233f8d24eed64
Error: fatal: ' 9007199254740991': not an integer
    at /home/runner/work/Storybook-Components/Storybook-Components/node_modules/gitlog/src/index.ts:384:13
    at ChildProcess.exithandler (node:child_process:430:5)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1098:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:303:5)
TypeError: error.match is not a function
    at Git.getGitLog (/home/runner/work/Storybook-Components/Storybook-Components/node_modules/@auto-it/core/src/git.ts:406:25)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Release.getCommits (/home/runner/work/Storybook-Components/Storybook-Components/node_modules/@auto-it/core/src/release.ts:284:20)
    at async Release.getCommitsInRelease (/home/runner/work/Storybook-Components/Storybook-Components/node_modules/@auto-it/core/src/release.ts:119:24)
    at async Auto.shipit (/home/runner/work/Storybook-Components/Storybook-Components/node_modules/@auto-it/core/src/auto.ts:1604:18)
    at async execute (/home/runner/work/Storybook-Components/Storybook-Components/node_modules/auto/src/run.ts:88:9)
    at async Object.runCli (/home/runner/work/Storybook-Components/Storybook-Components/node_modules/auto/src/run.ts:146:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

To Reproduce

Run auto shipit

Expected behavior

Expected that the release finishes successfully, which was working as of last Friday (2/16).

Screenshots

Environment information:

Running npx auto info gives me an error saying environment variables are missing. I think they are only set in the build process, not locally.

PS C:\Dev\Alterra\Storybook-Components> npx auto info
‼  warning   protected-branch: No "PROTECTED_BRANCH_REVIEWER_TOKEN" found in environment
×  error     No GitHub was found. Make sure it is available on process.env.GH_TOKEN.
Error: GitHub token not found!
    at Auto.loadConfig (C:\Dev\Alterra\Storybook-Components\node_modules\@auto-it\core\src\auto.ts:657:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async execute (C:\Dev\Alterra\Storybook-Components\node_modules\auto\src\run.ts:36:5)
    at async Object.runCli (C:\Dev\Alterra\Storybook-Components\node_modules\auto\src\run.ts:146:3)

However, the build does show the following information:

Environment Information:
"auto" version: v10.46.0
"git"  version: v2.43.2
"node" version: v18.19.1
Project Information:
✔ Repository:      Alterra-Mountain-Company/Storybook-Components (​[https://github.com/Alterra-Mountain-Company/Storybook-Components​)](https://github.com/Alterra-Mountain-Company/Storybook-Components%E2%80%8B))
✔ Author Name:     Alterra Mountain Company
✔ Author Email:    [email protected]
✔ Current Version: v18.4.7
✔ Latest Release:  v18.4.7 (​[https://github.com/Alterra-Mountain-Company/Storybook-Components/releases/tag/v18.4.7​)](https://github.com/Alterra-Mountain-Company/Storybook-Components/releases/tag/v18.4.7%E2%80%8B))
✖ Labels configured on GitHub project (Try running "auto create-labels")
GitHub Token Information:
✔ Token:            [Token starting with ghp_]
✔ Repo Permission:  write
✔ User:             resortinfra-alterra
✔ API:              undefined (​undefined​)
✔ Enabled Scopes:   repo, workflow
✔ Rate Limit:       4996/5000

Additional context

9007199254740991 is the value of Number.MAX_SAFE_INTEGER, which I noticed is referenced in the getGitLog method of @auto-it/core/dist/git.js. I am just not sure why, or where, Auto is converting it to a string.

aldrichdev avatar Feb 20 '24 21:02 aldrichdev

Oddly, this issue resolved itself after removing my package-lock.json file (there was a warning about it in the build, since we also have yarn.lock and use yarn mostly), and adding "license": "UNLICENSED", to my package.json, which fixed another warning. Did not think these two changes would fix the issue altogether, but that seems to be what has occurred. Closing.

aldrichdev avatar Feb 20 '24 21:02 aldrichdev

Actually, it seems the issue resolved itself only temporarily. Even with the changes I mentioned above still applied, I am getting the same error again with a new PR. So I still need help.

aldrichdev avatar Feb 21 '24 00:02 aldrichdev

I also started getting this exact error today.

"auto" version: v10.42.2
"git"  version: v2.43.2
"node" version: v20.11.1

patjacobs-magic avatar Feb 21 '24 06:02 patjacobs-magic

Git v2.43.2 seems to be the issue, v2.42.0 still works:

> git log -n 9007199254740991
fatal: '9007199254740991': not an integer

mackermans avatar Feb 21 '24 12:02 mackermans

Number.MAX_SAFE_INTEGER seems to be too big now as of git v2.43.2, we ended up patching it and using 2147483647 as the new safe maximum instead. This repo seems unmaintained though so I can highly recommend patching it manually for now

attehuhtakangas avatar Feb 21 '24 13:02 attehuhtakangas

@jazmon Do you have an example of the patch? Unsure what and where you'd put a fix. Thanks

ecstaticrainbow avatar Feb 21 '24 13:02 ecstaticrainbow

@ecstaticrainbow here

index a28a5eb2565d237bd0eff65e6222511287424b5a..464a642e71538ed8e79291b41bae821512eaa950 100644
--- a/dist/git.js
+++ b/dist/git.js
@@ -240,9 +240,11 @@ class Git {
             const startSha = (await this.shaExists(start))
                 ? await exec_promise_1.default("git", ["rev-parse", start])
                 : "";
+            const maxNumber = 2147483647;
             const log = await gitlog_1.gitlogPromise({
                 repo: process.cwd(),
-                number: Number.MAX_SAFE_INTEGER,
+                number: maxNumber,
                 fields: ["hash", "authorName", "authorEmail", "rawBody"],
                 // If start === firstCommit then we want to include that commit in the changelog
                 // Otherwise it was that last release and should not be included in the release.

attehuhtakangas avatar Feb 21 '24 13:02 attehuhtakangas

@jazmon could you still submit a PR? I can do it if you don't have time, just let me know.

Maybe we can get @hipstersmoothie to merge the fix for this blocking bug?

laughedelic avatar Feb 21 '24 15:02 laughedelic

I would but I have an open PR https://github.com/intuit/auto/pull/2414 that fixes another bug here and it's been open for months without anyone looking at it, doesn't seem very productive to create any more PRs to fix things. Might need to fork this library instead

attehuhtakangas avatar Feb 21 '24 15:02 attehuhtakangas

PR opened : #2426

Zweer avatar Feb 21 '24 17:02 Zweer

If anyone is running into this on Github Actions ubuntu runner, I have the worst temporary workaround ever:

- name: Install specific git version
  run: |
    sudo apt-get update
    sudo add-apt-repository ppa:git-core/ppa 
    sudo apt install git=1:2.34.1-1ubuntu1.10 git-man=1:2.34.1-1ubuntu1.10 -y --allow-downgrades

don't judge me, it works.

tferullo avatar Feb 21 '24 17:02 tferullo

@tferullo It works with these specific git versions. This should be fixed in this repo.

sqaisar avatar Feb 21 '24 18:02 sqaisar

Here is a shell command that applies the fix from @jazmon

sed -i 's/Number.MAX_SAFE_INTEGER/2147483647/' ./node_modules/@auto-it/core/dist/git.js

Ermag avatar Feb 21 '24 18:02 Ermag

Thanks @Zweer for the PR 👍

If anyone is running into this on Github Actions ubuntu runner, I have the worst temporary workaround ever:

- name: Install specific git version
  run: |
    sudo apt-get update
    sudo add-apt-repository ppa:git-core/ppa 
    sudo apt install git=1:2.34.1-1ubuntu1.10 git-man=1:2.34.1-1ubuntu1.10 -y --allow-downgrades

don't judge me, it works.

This will fail once that version of git is not published in the git-core ppa anymore

attehuhtakangas avatar Feb 21 '24 18:02 attehuhtakangas

This will fail once that version of git is not published in the git-core ppa anymore

Yup, very excited for that 😄

tferullo avatar Feb 21 '24 19:02 tferullo

This will fail once that version of git is not published in the git-core ppa anymore

Yup, very excited for that 😄

I think you command is actually installing the ubuntu repo version not the ppa.

fernandoiury avatar Feb 21 '24 19:02 fernandoiury

Also having the same issue for my repos using Auto, starting today.

wpniederer avatar Feb 21 '24 20:02 wpniederer

We're getting the fix out!

hipstersmoothie avatar Feb 21 '24 21:02 hipstersmoothie

11.0.5 fixes the issue for me. Thank you for the quick turnaround!

patjacobs-magic avatar Feb 22 '24 05:02 patjacobs-magic

11.0.5 is working well so far. Thank you @jazmon, @Zweer and @hipstersmoothie! Closing this issue.

aldrichdev avatar Feb 22 '24 16:02 aldrichdev