[Alpine] Distribution Support
omer-bar opened this issue ยท 23 comments
- NodeJS: 14.6.0
- mongodb-memory-server-*: 6.6.6
- mongodb: 0.0.0
- mongoose: 5.9.28
- system: docker:alpine (host: Windows 10)
package: mongo-memory-server
What is the Problem?
So when ever i try to install mongodb-memory-server on my Windows 10 machine i get this error:
mongodb-memory-server: checking MongoDB binaries cache...
failed to download/install MongoDB binaries. The error: Error: Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination doesn't exist
The mongo instance is dockerized(using node:alpine) but even just a simple install doesnt work.
the project is a microservice site and another service is already working just fine with mongodb-memory-server in version 6.6.4
so i tried to install 6.6.4 thinking the cause is probably a bad version but even 6.6.4 which works perfectly good for the other service doesnt work on this service for some reason and still gives the same error on npm install.
Code Example
Do you know why it happenes?
have no idea since the other service works just fine with 6.6.4 version.
from my knowledge, there still isnt an alpine version of mongodb, so you need to either configure an version that works with that alpine, or provide your own file
from my knowledge, there still isnt an alpine version of mongodb, so you need to either configure an version that works with that alpine, or provide your own file
Thanks for the fast reply,
the problem also happens on windows not just in the container, and its weird since i have a working service for 'user Auth' working in kubernetes&docker that uses mongodb-memory-server perfectly good, its also an alpine distro.
did you already check these:
- did you run docker locally with file passthrough?
- did you check that nothing from host's node_modules (especially .cache) is included in your container?
and could you provide debug output? *should be tried inside code, you can skip the postInstall-download with disablePostinstall
did you already check these:
* did you run docker locally with file passthrough? * did you check that nothing from host's node_modules (especially .cache) is included in your container?
and could you provide debug output? *should be tried inside code, you can skip the postInstall-download with
disablePostinstall
i just opened a new folder called test, ran npm init -y, ran npm install mongodb-memory-server and got the same error:
mongodb-memory-server@6.6.7 postinstall D:\Microservices Projects\test\node_modules\mongodb-memory-server
node ./postinstall.jsmongodb-memory-server: checking MongoDB binaries cache...
failed to download/install MongoDB binaries. The error: Error: Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination doesn't exist
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.
- mongodb-memory-server@6.6.7
added 88 packages from 93 contributors and audited 88 packages in 8.142s8 packages are looking for funding
runnpm fund
for detailsfound 0 vulnerabilities
it has nothing to do with docker. its a windows problem not a docker problem.
this error means the requested version (combined from wanted mongodb version, system and some extra options) does not exist, so please provide the debug log for us to investigate what url got generated and what it should have been
Same thing happened to me. In windows, I went back to v6.2.1 and that worked
Same problem on Windows 10. I can't get any version of this package to download the mongod binaries.
could someone provide debug output to know what got generated? https://github.com/nodkz/mongodb-memory-server#enable-debug-mode
Same error message, hopefully this debug output helps:
$ yarn test
yarn run v1.22.4
$ jest
Determining test suites to run... MongoMS:MongoMemoryServer Called MongoMemoryServer.start() method +0ms
MongoMS:MongoMemoryServer Starting MongoDB instance with following options: {"port":35013,"dbName":"1ee3480d-24e2-41e7-90be-a0f57b038c5e","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"/tmp/mongo-mem--24626-NznDIBBp08ZD","tmpDir":{"name":"/tmp/mongo-mem--24626-NznDIBBp08ZD"},"uri":"mongodb://127.0.0.1:35013/1ee3480d-24e2-41e7-90be-a0f57b038c5e?"} +4ms
MongoMS:MongoBinary MongoBinary options: {"downloadDir":"/reponame/node_modules/.cache/mongodb-memory-server/mongodb-binaries","platform":"linux","arch":"x64","version":"4.0.14","checkMD5":false,"skipMD5":true} +0ms
MongoMS:getos Trying LSB-Release +0ms
MongoMS:MongoBinaryDownloadUrl Using "mongodb-linux-x86_64-debian10-4.0.14.tgz" as the Archive String +0ms
MongoMS:MongoBinaryDownloadUrl Using "https://fastdl.mongodb.org" as the mirror +1ms
MongoMS:MongoBinaryDownload Downloading: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.0.14.tgz" +0ms
MongoMS:MongoBinaryDownload trying to download https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.0.14.tgz +2ms
Error: Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination doesn't exist
at ClientRequest.<anonymous> (/reponame/node_modules/mongodb-memory-server-core/lib/util/MongoBinaryDownload.js:378:44)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
at TLSSocket.socketOnData (_http_client.js:469:22)
at TLSSocket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at TLSSocket.Readable.push (_stream_readable.js:212:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This happened on Debian Buster.
@mick352 thanks to this log, it is easy for your problem, you are running debian10 (buster), and try to download version 4.0.14
(default), while there is no debian10 image below 4.1 or 4.2 (i cant remember)
(your problem
because this issue is about windows 10, and debian10 is already known (other issues))
I just downloaded a copy of 4.2.9, disabled postInstall, and pointed the config to my downloaded mongod.exe, which avoids this whole mess. It works fine after cutting out the failing automatic download attempt.
The steps that fixed it for me:
- find out latest tgz version : https://www.mongodb.com/try/download/community
- select version, platform, package: tgz
- click "Copy Link"
- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.4.1.tgz
- export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.4.1.tgz
- export MONGOMS_VERSION=4.4.1
- run test
as an update, i tried the alpine:latest
package, with some mongodb binaries, none of them worked (of course not, because linked with gcc
instead of what alpine uses)
here the packages i tried running:
- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.4.1.tgz
- http://downloads.mongodb.org/linux/mongodb-linux-x86_64-4.0.20.tgz
so it seems the only workaround for a while is to not use alpine
(when using nodejs, instead of node:*alpine*
, use node:*buster*
or node:*stretch*
[debian base])
@hasezoey thank you so much for you up to date. I was suffering with that error only on CI/CD pipeline and when I update node version to 15-buster
that was solved.
I'm having the same issue when using a github workflow.
name: CI
on: [push]
jobs:
build:
name: Test
runs-on: ubuntu-latest
container:
image: node:15-buster # I tried this as per the recommendation above, but it still didn't work
steps:
# ...
I know absolutely nothing about docker, images, etc. Does anyone know what I'm doing wrong?
if you want an github workflow, this project uses them, so you could look at the files for an example tests.yml
Hi @hasezoey, thanks for the quick response. Specifically what in the .yml
file is relevant to the issue? Is it the --cwd
flag when running yarn?
I'm realizing that's probably just specifying which folder to execute the yarn command in ๐ . Is it the node version?
the important parts are:
name: Node.js CI
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x] # the node versions to run this all against
steps:
- uses: actions/checkout@v2 # checkout the git repo
- name: Use Node.js ${{ matrix.node-version }} # install the node version for this run
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules # install the node modules
run: yarn
- name: Here whatever other steps might also be needed
run: something
I changed a bit and it worked. Thanks!
Hi, Im get this same error but for Arch Linux.
My mongo is the 4.4.5 version and when I try run a jest test returns the following error for me:
Falling back to legacy MongoDB build!
Starting the instance failed, please enable debug for more infomation
Error: Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination doesn't exist
Used Url: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.2.7.tgz"
Try to use different version 'new MongoMemoryServer({ binary: { version: 'X.Y.Z' } })'
List of available versions can be found here:
https://www.mongodb.org/dl/linux for Linux
https://www.mongodb.org/dl/osx for OSX
https://www.mongodb.org/dl/win32 for Windows
at ClientRequest.<anonymous> (/home/daniloab/Documents/projects/application/node_modules/mongodb-memory-server-core/lib/util/MongoBinaryDownload.js:386:44)
at Object.onceWrapper (node:events:476:26)
at ClientRequest.emit (node:events:369:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:646:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:129:17)
at TLSSocket.socketOnData (node:_http_client:512:22)
at TLSSocket.emit (node:events:369:20)
at addChunk (node:internal/streams/readable:313:12)
at readableAddChunk (node:internal/streams/readable:288:9)
at TLSSocket.Readable.push (node:internal/streams/readable:227:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
My setup.js is configured for 4.2.7
version. From this, I have two doubts:
1 - I want to know where I put the MONGOMS_VERSION
env variable. Is it into my root .env file from the project? Is it into my bashrc? Where?
2 - With my MongoDB version being 4.4.5
which version is the correct to put into the env above mentioned for works with Arch Linux?
Fixed the comment above exporting a new env variable setting a specific download url
see here https://gist.github.com/daniloab/b3b5fd804f5ef6c9c2de1239a6e59baf