Build Error within aerospike-client-c-src-4.6.8

I’m trying to put the Aerospike Node.js client into an alpine Docker container. This needs some building the client-c-src. The actual build process is split up into 3 different stages.

  • Stage 1: Build Aerospike C client (this one succeeds)
  • Stage 2: Build Aerospike Node.js client (this one fails)
  • Stage 3: Aerospike Node.js Runtime (this one is skipped)

FYI: The Dockerfile and the build logs are attached to this post. docker.tar.gz (16.9 KB)

Basically the issue is that node-gyp rebuild is failing at some point with the following error message.

../src/main/enums/status.cc: In function 'v8::Local<v8::Object> status()':
../src/main/enums/status.cc:90:49: error: 'AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND' was not declared in this scope
  set(obj, "AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND", AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/main/enums/status.cc:26:92: note: in definition of macro 'set'
 #define set(__obj, __name, __value) __obj->Set(Nan::New(__name).ToLocalChecked(), Nan::New(__value))
                                                                                            ^~~~~~~
../src/main/enums/status.cc:90:49: note: suggested alternative: 'AEROSPIKE_ERR_LUA_FILE_NOT_FOUND'
  set(obj, "AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND", AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/main/enums/status.cc:26:92: note: in definition of macro 'set'
 #define set(__obj, __name, __value) __obj->Set(Nan::New(__name).ToLocalChecked(), Nan::New(__value))
                                                                                            ^~~~~~~

Has anyone stumbled upon a similar issue and can point me here in the right direction?

You need to use compatible Node.js & C client versions. The latest released Node.js client v3.13.0 requires C client v4.6.7: https://github.com/aerospike/aerospike-client-nodejs/blob/v3.13.0/aerospike-client-c.ini

Only the next Node.js client version (v3.14.0) will be compatible with v4.6.8 of the C client: https://github.com/aerospike/aerospike-client-nodejs/pull/321

Sorry for the late response. However, thank you so much for the help @Jan. I’ll give it a try with the Node.js client 3.13.0 and the C client with 4.6.7.

Building the Dockerfile even when the version is set to 4.6.7 seems to fail with my setup. Actually the only thing I wanted to achieve was to base my Dockerfile on node:10-alpine and not node:10-slim. It seems that I did make it altogether too complicated.

I had a look at closed issues concerning Alpine on the GitHub repository for the Node.js client. Luckily, you were active there, too :slight_smile:

So what’s working perfectly fine for me is your suggestion here https://github.com/aerospike/aerospike-client-nodejs/issues/299#issuecomment-496062384.

Edit:

The only negative point is now the bit bigger size of all image layers for the created image which is now around 678 MB. For the approach with node:10-slim, I’m at 631 MB. This means I’ll stay with the following Dockerfile for my Node.js 10 with Yarn.

FROM node:10-slim

RUN apt-get update
RUN apt-get install python make g++ openssl libssl-dev libz-dev -y

RUN npm install -g yarn

WORKDIR /workdir
COPY package.json .
COPY yarn.lock .
COPY tools/preinstall.js tools/preinstall.js

RUN yarn install --production=true --pure-lockfile

COPY . .

EXPOSE 80
HEALTHCHECK CMD curl --fail http://0.0.0.0/ || exit 1

CMD [ "yarn", "start" ]

Note that the Dockerfile I had posted in issue #299 on Github is not optimized for image size. For a real production build, you would probably want to remove both the C client repo as well as the whole C/C++ build toolchain again, once the C client SDK and Node.js client were build successfully. That should drastically reduce the final image size.

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.