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

[Alpine] Distribution Support #347

Open
omer-bar opened this issue Aug 29, 2020 · 23 comments
Open

[Alpine] Distribution Support #347

omer-bar opened this issue Aug 29, 2020 · 23 comments
Labels
Distribution support Add / modify an (linux) distribution

Comments

@omer-bar
Copy link

omer-bar commented Aug 29, 2020

  • 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.

@omer-bar omer-bar added the bug label Aug 29, 2020
@hasezoey
Copy link
Member

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

@hasezoey hasezoey added Distribution support Add / modify an (linux) distribution and removed bug labels Aug 29, 2020
@omer-bar
Copy link
Author

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.

@hasezoey
Copy link
Member

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

@omer-bar
Copy link
Author

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.js

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
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.142s

8 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

it has nothing to do with docker. its a windows problem not a docker problem.

@hasezoey
Copy link
Member

hasezoey commented Aug 29, 2020

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

@joriente
Copy link

joriente commented Sep 5, 2020

Same thing happened to me. In windows, I went back to v6.2.1 and that worked

@mbparker

This comment has been minimized.

@hasezoey
Copy link
Member

hasezoey commented Sep 7, 2020

could someone provide debug output to know what got generated? https://github.com/nodkz/mongodb-memory-server#enable-debug-mode

@mick352

This comment has been minimized.

@hasezoey

This comment has been minimized.

@mbparker

This comment has been minimized.

@hasezoey hasezoey changed the title unable to install mongodb-memory-server from npm (Status Code is 403) [Alpine] Distribution Support Sep 8, 2020
@mick352
Copy link

mick352 commented Sep 11, 2020

The steps that fixed it for me:

  1. find out latest tgz version : https://www.mongodb.com/try/download/community
  2. export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.4.1.tgz
  3. export MONGOMS_VERSION=4.4.1
  4. run test

@hasezoey
Copy link
Member

hasezoey commented Feb 22, 2021

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:

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])

@fabianoalmeida
Copy link

@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.

@Lioness100
Copy link

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?

@hasezoey
Copy link
Member

hasezoey commented Apr 7, 2021

if you want an github workflow, this project uses them, so you could look at the files for an example tests.yml

@Lioness100
Copy link

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?

@Lioness100
Copy link

I'm realizing that's probably just specifying which folder to execute the yarn command in 😅. Is it the node version?

@hasezoey
Copy link
Member

hasezoey commented Apr 8, 2021

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

@Lioness100
Copy link

I changed a bit and it worked. Thanks!

@daniloab

This comment has been minimized.

@daniloab

This comment has been minimized.

@hasezoey

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Distribution support Add / modify an (linux) distribution
Projects
None yet
Development

No branches or pull requests

8 participants