Bitbucket pipeline mongodb-memory-server missing "libcrypto.so.1.1"

Tuomas Pesola June 19, 2023

I have a bitbucket pipeline setup with multiple steps.

The steps with 'unit tests' uses mongodb-memory-server to mock the mongodb.

The setup is as follows and this gets rid of the same error on ubuntu 2204 (libcrypt...)

 

"config": {
    "mongodbMemoryServer": {
        "md5Check": false,
        "version": "6.0.6"
     }
},

 

But when i run in the pipeline i get the  error.

Pipeline config:

- step:
    name: 'Unit tests'
    image: node:18
    caches:
        - pnpm
    script:
        - echo "Starting with unit tests ..."
        - corepack enable
        - pnpm install
        - pnpm test:unit
     trigger: automatic
Error in CI/CD:

Starting the MongoMemoryServer Instance failed, enable debug log for more information. Error:
16
StdoutInstanceError: Instance failed to start because a library is missing or cannot be opened: "libcrypto.so.1.1"
17
at MongoInstance.checkErrorInLine (/opt/atlassian/pipelines/agent/build/node_modules/.pnpm/mongodb-memory-server-core@8.12.2/node_modules/mongodb-memory-server-core/src/util/MongoInstance.ts:678:11)
18
at MongoInstance.stderrHandler (/opt/atlassian/pipelines/agent/build/node_modules/.pnpm/mongodb-memory-server-core@8.12.2/node_modules/mongodb-memory-server-core/src/util/MongoInstance.ts:563:10)
19
at Socket.emit (node:events:513:28)
20
at Socket.emit (node:domain:489:12)
21
at addChunk (node:internal/streams/readable:324:12)
22
at readableAddChunk (node:internal/streams/readable:297:9)
23
at Socket.Readable.push (node:internal/streams/readable:234:10)
24
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
25
Error: Instance failed to start because a library is missing or cannot be opened: "libcrypto.so.1.1"
26
at MongoInstance.checkErrorInLine (/opt/atlassian/pipelines/agent/build/node_modules/.pnpm/mongodb-memory-server-core@8.12.2/node_modules/mongodb-memory-server-core/src/util/MongoInstance.ts:678:11)
27
at MongoInstance.stderrHandler (/opt/atlassian/pipelines/agent/build/node_modules/.pnpm/mongodb-memory-server-core@8.12.2/node_modules/mongodb-memory-server-core/src/util/MongoInstance.ts:563:10)
28
at Socket.emit (node:events:513:28)
29
at Socket.emit (node:domain:489:12)
30
at addChunk (node:internal/streams/readable:324:12)
31
at readableAddChunk (node:internal/streams/readable:297:9)
32
at Socket.Readable.push (node:internal/streams/readable:234:10)
33
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
34
 ELIFECYCLE  Command failed with exit code 1.

1 answer

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2023

Hi @Tuomas Pesola and welcome to the community!

Just to give you some context, Pipelines builds run in Docker containers. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file. For this specific step, the DockerHub image node:18 is used.

Every Docker image may use a different version of Linux and it may have different applications and libraries pre-installed. For example, the DockerHub image node:18 is using Debian 12 (bookworm).

If your build needs the library mentioned in the error message, you can either install it during the build or you can try using a different Docker image or a different tag of the node image that has this library.

You can debug this step locally with Docker and try different Docker images or execute additional commands until you have a step that works, before making any changes in your yml file:

Kind regards,
Theodora

Tuomas Pesola June 21, 2023

Thanks!

I found something that works, but i am not sure how "kosher" it is :D

Found that by installing the libssl1.1 package directly from ubuntu archives works like a charm. (since ubuntu is debian based, i feel this should be ok).

 

Here is my current (working) pipeline step:


- step:
    name: 'Unit tests'
    image: node:18
    caches:
        - pnpm
     script:
         - echo "Starting with unit tests ..."
         - dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
         - corepack enable
         - pnpm install
         - npx prisma generate
         - pnpm test:unit
    trigger: automatic
Like # people like this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2023

That's good to hear Tuomas, thank you for sharing the solution here!

Like Raphael Ofagbe likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events