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

Keypair fromSecret causes Segmentation Fault in node alpine #798

Open
bitgoAaron opened this issue Nov 8, 2022 · 4 comments
Open

Keypair fromSecret causes Segmentation Fault in node alpine #798

bitgoAaron opened this issue Nov 8, 2022 · 4 comments
Labels

Comments

@bitgoAaron
Copy link

bitgoAaron commented Nov 8, 2022

Describe the bug
Trying to use stellar-sdk's Keypair fromSecret function does not work in alpine flavors of linux.

What version are you on?

  • stellar-sdk@10.4.0

To Reproduce

  • npm init -y && npm i stellar-sdk@latest
  • edit package.json :
   "scripts": {
      "test": "node index.js"
    }
  • Create an index.js file:
const stellar = require('stellar-sdk');
const prv = 'SA22TDBINLZMGYUDVXGUP2JMYIQ3DTJE53PNQUVCDK73XRS6TDVYU7WW';
console.log(stellar.Keypair.fromSecret(prv));
  • docker run -it -v $(pwd):/srv -w /srv node:16-alpine npm run test

Error Output:

npm ERR! path /srv
npm ERR! command failed
npm ERR! signal SIGSEGV
npm ERR! command sh -c -- node index.js

Expected behavior

  • Should work without throwing a SIGSEGV (segmentation fault) when creating a KeyPair

Additional context

  • node16 and node18 (non-alpine) work fine.
@bitgoAaron bitgoAaron added the bug label Nov 8, 2022
@corymsmith
Copy link

@bitgoAaron I was running into the same issues and managed to get it working on node 16 slim. I also installed build-essential using apt-get. The final image size didn't end up being that much larger.

@1baga
Copy link

1baga commented Jun 1, 2023

Spent 3 days trying to understand why my project worked locally but when i deploy to kubernetes cluster it doesn't even start.

Thanks @corymsmith

@corymsmith
Copy link

corymsmith commented Jun 1, 2023 via email

@Shaptic
Copy link
Contributor

Shaptic commented Jun 2, 2023

Thanks for bringing this thread out from the depths, guys, and documenting the solution @corymsmith 🙏

I imagine this is because sodium-native fails to compile, which you can (probably) work around by not installing optional dependencies (npm i --omit optional stellar-sdk).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@corymsmith @Shaptic @1baga @bitgoAaron and others