question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma fails to generate artifacts with NodeJS Alpine image on M1 Mac

See original GitHub issue

Bug description

Following the request from Jan here, I’ve created this as a new ticket.

While attempting to build/run prisma using a NodeJS Alpine image, prisma fails to generate artifacts during the postinstall script, as a result, running the application cannot find generated models and typescript type-checking fails.

When observing the npm install logs, I note the following error:

Error: Unknown binaryTarget linux-arm-openssl-undefined and no custom binaries were provided. Which has been tracked before, but according to recent posts, this should still work within Rosetta 2 emulation, right?

I should note, that if I run a general FROM node:14, the project builds no problem, using FROM node:14-slim or alpine fails.

I’ve attached the docker build logs so you can see the failing script line here:

build-output.txt

How to reproduce

  1. Use M1 Mac
  2. Clone the following NestJS Prisma repo I’ve created: https://github.com/uncvrd/prisma-alpine-docker
  3. Build the image using: docker build -t [IMAGE TAG] --target development --no-cache --progress plain .
  4. Run the built image locally and observe the missing generated files

Expected behavior

I expect to be able to build and run using NodeJS Alpine on M1 Mac. I can confirm that this Dockerfile works as expected on an Intel Mac so I guess the Rosetta 2 emulation is not running as expected?

Prisma information

Prisma schema etc. is referenced in the repository above.

Environment & setup

  • OS: Mac OS Big Sur 11.4
  • Database: PostgreSQL
  • Node.js version: 14 (in docker image)

Prisma Version

prisma               : 2.21.2
@prisma/client       : 2.21.2
Current platform     : darwin
Query Engine         : query-engine e421996c87d5f3c8f7eeadd502d4ad402c89464d (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli e421996c87d5f3c8f7eeadd502d4ad402c89464d (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core e421996c87d5f3c8f7eeadd502d4ad402c89464d (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt e421996c87d5f3c8f7eeadd502d4ad402c89464d (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : e421996c87d5f3c8f7eeadd502d4ad402c89464d
Studio               : 0.371.0

^ ran this inside the docker container, I do find it interesting that it shows darwin as this is an alpine image running in the docker container?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:24 (8 by maintainers)

github_iconTop GitHub Comments

18reactions
stingallemancommented, Jul 20, 2021

Not using Alpina will result in really large Docker images, so it would be helpful if binaries get made for this situation.

13reactions
uncvrdcommented, Jun 19, 2021

Hey @janpio I have now tested on 3 different devices using the referenced repo:

  • iMac M1: Fails during postinstall hook Error: Unknown binaryTarget linux-arm-openssl-undefined and no custom binaries were provided
  • Macbook Pro M1: Fails during postinstall hook Error: Unknown binaryTarget linux-arm-openssl-undefined and no custom binaries were provided
  • Macbook Pro Intel: Succeeds

Hope that helps, What can I help with next?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue building docker image containing prisma on mac M1
I have a docker image that contains prisma and runs on node16 alpine. The container mounts fine, but when I try to run...
Read more >
Macbook M1 Node Js Docker Image Build Failed - ADocLib
Docker Desktop for Mac on Apple silicon is now available as a GA release. ... Prisma fails to generate artifacts with NodeJS Alpine...
Read more >
Dockerize Next.js With Prisma App | JavaScript in Plain English
Simple docker file for your Next.js/Node.js app with Prisma. ... commands such npx prisma generate on M1 chips with Node alpine base image, ......
Read more >
twistcli - Prisma Cloud - Palo Alto Networks
Prisma Cloud ships a command-line configuration and control tool known as twistcli. It is supported on Linux, macOS, and Windows.
Read more >
[solved] Failing to build dockerfile for ARM servers; rpc error ...
Build SafeNetwork Docker container FROM arm64v8/alpine:latest LABEL ... org.opencontainers.image.description=Safe network node for hosting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found