1

I have a Prisma client connected to a local MySQL database inside of an express server. The server and database work fine at first and the typings are also correct. But:

After running npx prisma migrate dev or npx prisma generate, nothing works anymore.

It always throws connect ECONNREFUSED ::1:50898 when performing any request

The only workaround that kind of works is creating the same exact schema again, but on another node project, doing prisma generate and then copying the generated ".prisma" folder inside of my node_modules.

The error comes up on my localhost MySQL DB, but also when connected to a PrismaCloud Postgres DB.

It is really annoying to me because I really likee Prisma, but with this issue I can't really use it productively.

I am using a global prisma client for my server like this:

import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

export default prisma;

My schema under ./prisma/schema.prisma looks like this:

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

model User {
  id           Int        @id @default(autoincrement())
  email        String     @unique
  password     String
}

my DATABASE_URL looks like this: DATABASE_URL="mysql://root:password@127.0.0.1:3306/merkurier?schema=public"

and an example of a failing query looks like this:

 const user = await prisma.user.findFirst({
            where: {
              email,
            },
          });

I am using an M1 mac and not using docker (maybe I should use Docker)

Mark Witt
  • 25
  • 1
  • 9
  • Hi, Tasin from the Prisma team here. Have you been able to replicate this on any other device or do you think it's only happening on your M1 Mac? There was someone else having trouble [with the Prisma Client on an M1](https://github.com/prisma/prisma/issues/10018), I can't be sure if these are related. Would you please check that issue if it's something similar? If it's not, I would request that you create a [bug report](https://github.com/prisma/prisma/issues/new/choose), _preferably with steps/instructions for reproduction_. That would really help us look into this. – Tasin Ishmam Nov 18 '21 at 19:06

1 Answers1

7

Prisma runs natively on the new M1 chips and there's nothing to configure, but I had the same issue, Prisma error: connect ECONNREFUSED ::1:50269, I realized that this problem can have different causes like unsupported NodeJS engine on your machine, Prisma under 3.x or query engine not reachable on your host
In my case, my issue resolved after install latest Prisma manually.
For installing the latest Prisma following command:

npm i --save-dev prisma@latest
npm i @prisma/client@latest
Saeed Rohani
  • 2,664
  • 1
  • 13
  • 12