You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2021-01-09T17:23:09.168Z MongoMS:MongoInstance Mongo[43073]: MongodbInstance: Instance has failed: Error: spawn /builds/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod ENOENT
2021-01-09T17:23:09.172Z MongoMS:MongoInstance Mongo[43073]: Mongod instance closed with an non-0 code!
2021-01-09T17:23:09.173Z MongoMS:MongoInstance Mongo[43073]: CLOSE: -2
2021-01-09T17:23:09.173Z MongoMS:MongoInstance Mongo[43073]: MongodbInstance: Instance has failed: Mongod instance closed with code "-2"
It runs locally but it fails through gitlab CI.
I know there are duplicates to this problem but their solution does not work for me.
Code Example
my ts code is
(it will not run as it is because they are parts taken from different files) but this is the gist of what I do
letmongoServer=newMongoMemoryServer();constfake_connection_url=awaitmongoServer.getUri()constoptions={useNewUrlParser: true,useUnifiedTopology: true};// Use connect method to connect to the serverreturnnewPromise((resolve,reject)=>{mongoClient.connect(connection_url,options,(err,client)=>{if(err){logger.log("error","Error connecting to MongoDB - "+err);reject(err);return;}logger.log("info","Connected successfully to server");db=client.db(dbName);adminDb=db.admin();dbClient=client;resolve('success');});});
I know that it happens because of Alpine and mongo incompatibility. But from the duplicate posts it should work if I put in the docker file something like
RUN echo'http://dl-cdn.alpinelinux.org/alpine/v3.9/main'>> /etc/apk/repositories
RUN echo'http://dl-cdn.alpinelinux.org/alpine/v3.9/community'>> /etc/apk/repositories
RUN apk update
# mongodb installation throws an error, but seems to work, so ignoring the exit status.
RUN apk add mongodb=4.0.5-r0 ||true# this is required by mongodb-memory-server to avoid trying to download the mongod file.
ENV MONGOMS_SYSTEM_BINARY=/usr/bin/mongod
but it does not work.
I have checked these related links but found nothing so far.
i would recommend to either switch this around and delete node_modules, or only copy src (and all other necessary files) instead of everything (because this merged node_modules from container and host) [because of #256]
otherwise, please try the latest beta release (currently being 7.0.0-beta.12)
Versions
package: mongo-memory-server
What is the Problem?
It runs locally but it fails through gitlab CI.
I know there are duplicates to this problem but their solution does not work for me.
Code Example
my ts code is
(it will not run as it is because they are parts taken from different files) but this is the gist of what I do
My dockerfile is :
Do you know why it happens?
I know that it happens because of Alpine and mongo incompatibility. But from the duplicate posts it should work if I put in the docker file something like
but it does not work.
I have checked these related links but found nothing so far.
any ideas?
The text was updated successfully, but these errors were encountered: