Open fellnerse opened 3 years ago
Oke resolved it, I forgot to make the files executable....but in my opinion the error message should somehow indicate that it was not able to load the files or something;
You could add a file to your repo for downloading the latest release files and making them executable, could be nice
It also seems like there is an issue with relative path. I can start a server using the binaries, but during runtime it fails, probably be cause the relative path is not resolved correctly; but I get only an errorcode -2, kind a hard to find. With absolute pathnames it works
I will look into writing more docs or adding an install script this weekend.
Refer to this documentation piece in the meanwhile: https://www.prisma.io/docs/concepts/components/prisma-engines#using-custom-engine-binaries
I also needed to patch Prisma so it includes 'arm-openssl-1.1.x'
in the available platforms in order to avoid the dreaded Unkown binaryTarget arm-openssl-1.1.x and no custom binaries were provided
error message.
I used patch-package
to do so. Here's my patch file:
prisma+2.28.0.patch
diff --git a/node_modules/prisma/build/index.js b/node_modules/prisma/build/index.js index 33a01a1..f2193a0 100755 --- a/node_modules/prisma/build/index.js +++ b/node_modules/prisma/build/index.js @@ -12146,6 +12146,7 @@ var require_platforms = __commonJS((exports2) => { "debian-openssl-1.1.x", "rhel-openssl-1.0.x", "rhel-openssl-1.1.x", + "arm-openssl-1.1.x", "linux-arm-openssl-1.1.x", "linux-arm-openssl-1.0.x", "linux-musl", diff --git a/node_modules/prisma/prisma-client/generator-build/index.js b/node_modules/prisma/prisma-client/generator-build/index.js index 521d129..b348f4a 100644 --- a/node_modules/prisma/prisma-client/generator-build/index.js +++ b/node_modules/prisma/prisma-client/generator-build/index.js @@ -12595,6 +12595,7 @@ var require_platforms2 = __commonJS2((exports2) => { "debian-openssl-1.1.x", "rhel-openssl-1.0.x", "rhel-openssl-1.1.x", + "arm-openssl-1.1.x", "linux-arm-openssl-1.1.x", "linux-arm-openssl-1.0.x", "linux-musl", @@ -28290,6 +28291,7 @@ var require_dist16 = __commonJS2((exports, module) => { "debian-openssl-1.1.x", "rhel-openssl-1.0.x", "rhel-openssl-1.1.x", + "arm-openssl-1.1.x", "linux-arm-openssl-1.1.x", "linux-arm-openssl-1.0.x", "linux-musl",
Additionally, big shoutout to you @pantharshit00 as you just saved me from 8-hours long compilation times for each release (multiply that number for the times there's a required update to rustc
you didn't know about). Many, many thanks 🙏
That should not be required. Can you open a new ticket in prisma/prisma ? We can add that to known binary targets like we added nixos even though it is not "officially" supported.
@pantharshit00 well I don't remember having to patch these for earlier prisma versions (back in the days I used to compile on my actual pi, silly me). I'll open an issue over there if you feel it makes sense!
Platform detection issue fixed in 3.1.0-dev.12
here is my working example (rpi4 armhf):
FROM node:lts-slim
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN addgroup --gid 1001 --quiet nextjs
RUN adduser --disabled-password --gecos "" --gid 1001 nextjs
RUN chown -R nextjs:nextjs /usr/src/app
ENV NODE_ENV production
COPY --chown=nextjs:nextjs public ./public
COPY --chown=nextjs:nextjs .next ./.next
COPY --chown=nextjs:nextjs package.json ./package.json
COPY --chown=nextjs:nextjs package-lock.json ./package-lock.json
COPY --chown=nextjs:nextjs schema.prisma ./schema.prisma
COPY --chown=nextjs:nextjs migrations ./migrations
RUN apt-get update
RUN apt-get -y install openssl wget
USER nextjs:nextjs
RUN wget --quiet https://github.com/pantharshit00/prisma-rpi-builds/releases/download/3.2.1/query-engine
RUN wget --quiet https://github.com/pantharshit00/prisma-rpi-builds/releases/download/3.2.1/libquery_engine.so
RUN wget --quiet https://github.com/pantharshit00/prisma-rpi-builds/releases/download/3.2.1/introspection-engine
RUN wget --quiet https://github.com/pantharshit00/prisma-rpi-builds/releases/download/3.2.1/migration-engine
RUN wget --quiet https://github.com/pantharshit00/prisma-rpi-builds/releases/download/3.2.1/prisma-fmt
RUN chmod +x query-engine
RUN chmod +x introspection-engine
RUN chmod +x migration-engine
RUN chmod +x prisma-fmt
RUN mv libquery_engine.so libquery_engine-linux-arm-openssl-1.1.x.so.node
ENV PRISMA_QUERY_ENGINE_BINARY /usr/src/app/query-engine
ENV PRISMA_QUERY_ENGINE_LIBRARY /usr/src/app/libquery_engine-linux-arm-openssl-1.1.x.so.node
ENV PRISMA_INTROSPECTION_ENGINE_BINARY /usr/src/app/introspection-engine
ENV PRISMA_MIGRATION_ENGINE_BINARY /usr/src/app/migration-engine
ENV PRISMA_FMT_BINARY /usr/src/app/prisma-fmt
ENV PRISMA_CLI_QUERY_ENGINE_TYPE binary
ENV PRISMA_QUERY_ENGINE_TYPE binary
RUN npm install
RUN npm run generate
ENV NEXT_TELEMETRY_DISABLED 1
EXPOSE 3000
CMD npx prisma migrate deploy ; npm run start
for some reason it does work in a docker container for me, but not running it straight on the pi. I am getting: Unable to load Node-API Library from ./prisma/libquery_engine-linux-arm-openssl-1.1.x.so.node, Library may be corrupt
Even though I added:
PRISMA_CLI_QUERY_ENGINE_TYPE=binary
PRISMA_QUERY_ENGINE_TYPE=binary
generator client {
provider = "prisma-client-js"
engineType = "binary"
}
Could you add a minimal working example?
I downloaded all 5 files and added the path like in the readme to my .env file, but I still get the error:
Unkown binaryTarget arm-openssl-1.1.x and no custom binaries were provided
Do I need to change my schema.prisma file? with the binaryTargets?
Can I somehow make sure it loads the engines correctly?
Openssl 1.1.1d is installed