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

Setting vX.X-latest as MongoDB version results in semver error on node:16 Docker image (Debian) #734

Closed
bvobart opened this issue Jan 17, 2023 · 4 comments
Labels
bug released Pull Request released | Issue is fixed

Comments

@bvobart
Copy link

bvobart commented Jan 17, 2023

Hi! According to your docs about the version config option, I should be able to use v5.0-latest to refer to the latest patch release of MongoDB 5.0. When I tried that locally on my own laptop, running Manjaro, I do indeed get the latest v5.0 binary (5.0.14 at the time of writing).

However, when I committed and pushed this config change, my CI, running on the node:16 Docker image, produced the following error:

Starting the instance failed, enable debug for more information
TypeError: Jest: Got error running globalSetup - /builds/my-org/my-service/src/testing/jest.globalSetup.ts, reason: Invalid Version: v5.0-latest
    at new SemVer (/builds/my-org/my-service/node_modules/semver/classes/semver.js:38:13)
    at compare (/builds/my-org/my-service/node_modules/semver/functions/compare.js:3:3)
    at Object.lte (/builds/my-org/my-service/node_modules/semver/functions/lte.js:2:30)
    at MongoBinaryDownloadUrl.getDebianVersionString (/builds/my-org/my-service/node_modules/mongodb-memory-server-core/lib/util/MongoBinaryDownloadUrl.js:181:24)
    at MongoBinaryDownloadUrl.getLinuxOSVersionString (/builds/my-org/my-service/node_modules/mongodb-memory-server-core/lib/util/MongoBinaryDownloadUrl.js:151:25)
    at MongoBinaryDownloadUrl.<anonymous> (/builds/my-org/my-service/node_modules/mongodb-memory-server-core/lib/util/MongoBinaryDownloadUrl.js:122:33)
    at Generator.next (<anonymous>)
    at /builds/my-org/my-service/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/builds/my-org/my-service/node_modules/tslib/tslib.js:113:16)
error Command failed with exit code 1.

I believe this refers to this line of code. Note that a similar check occurs in the same function several lines below and might also occur more often in this file, I didn't check.

https://github.com/nodkz/mongodb-memory-server/blob/ee9b710ca5cba2557b52ac892969f0fc7f18682a/packages/mongodb-memory-server-core/src/util/MongoBinaryDownloadUrl.ts#L250

SemVer obviously finds v5.0-latest to be an invalid semantic version. However, your docs say it's a valid configuration option and on Manjaro (thus also Ubuntu) it downloads a proper binary just fine. Can you fix this bug?

P.S. This is a great library and I love using it through jest-mongodb. Big thanks and kudos for your work!

@hasezoey hasezoey added the bug label Jan 17, 2023
@hasezoey
Copy link
Member

thanks for reporting, next time please use the proper issue template (even if not all options apply)

@github-actions
Copy link

@github-actions github-actions bot added the released Pull Request released | Issue is fixed label Jan 18, 2023
@hasezoey
Copy link
Member

@bvobart this should be fixed in 8.11.2, can you confirm?

@bvobart
Copy link
Author

bvobart commented Jan 19, 2023

@hasezoey Wow that was quick, nice work, thanks for the fix!! I can indeed confirm that the issue has now been resolved with 8.11.2! I'll go make an issue with jest-mongodb to ask them to update mongodb-memory-server to 8.11.2. EDIT: they already had a renovate bot PR up with this change, so I commented on it tagging on of the devs and this has now been released in jest-mongodb 4.1.5 🥳

Apologies for not using the issue template btw. I had first found the offending line of code in your source code, then used the hamburger menu on that line to create an issue referencing that specific line. Apparently then GitHub skips your issue template and only produces a code reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug released Pull Request released | Issue is fixed
Projects
None yet
Development

No branches or pull requests

2 participants