ChainSafe / ChainSafe/pubkey-index-map

Bug on missing nativebinding for @chainsafe/pubkey-index-map-linux-x64-musl on node:alpine images

Open
#4 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

When running a Node.js application on an Alpine-based Docker image (node:20-alpine3.20), I encounter issues with missing native bindings for the `pubkey-index-map ` package. Specifically, the application tries to load a native binding for musl (the C library used by Alpine Linux), but the required binding is not found, leading to errors.

on node:20-alpine3.20 this file is missing on your releases : `https://github.com/ChainSafe/pubkey-index-map/blob/main/index.js#L177`

The package has bindings for linux-x64-gnu (glibc) but not for linux-x64-musl (musl).
I think you should add the mssing package to your release and add a backup plan to use other existing bindings

```
if (isMusl()) {
try {
nativeBinding = require('@chainsafe/pubkey-index-map-linux-x64-musl');
} catch (e) {
nativeBinding = require('@chainsafe/pubkey-index-map-linux-x64-gnu');
}
}
```

sample Dockerfile:

```
FROM .....node:20-alpine3.20 as build

# Install build dependencies
RUN apk add --no-cache python3 py3-setuptools make g++

RUN apk add --update npm

RUN npm ci

```

These are the files I see under your package dir inside the docker image built in alpine

```
...node_modules/@chainsafe $ ls
as-sha256 blst-linux-x64-gnu persistent-ts swap-or-not-shuffle-linux-x64-gnu
bls blst-linux-x64-musl pubkey-index-map swap-or-not-shuffle-linux-x64-musl
bls-hd-key hashtree pubkey-index-map-linux-x64-gnu
bls-keygen hashtree-linux-x64-gnu ssz
blst persistent-merkle-tree swap-or-not-shuffle
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.