Skip to content

Commit

Permalink
fix: add hints for query-engine path on Vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovyerus committed Jul 28, 2021
1 parent 95f9aab commit 01386ef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pages/api/format.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { formatSchema } from "@prisma/sdk";
import { NextApiRequest, NextApiResponse } from "next";

import { fixPrisma } from "~/util/server";

fixPrisma();

export default async function (req: NextApiRequest, res: NextApiResponse) {
if (req.method !== "POST")
return res.status(405).json({ message: "Method Not Allowed" });
Expand Down
3 changes: 3 additions & 0 deletions pages/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { NextApiRequest, NextApiResponse } from "next";
import stripAnsi from "strip-ansi";

import { parseDMMFError } from "~/util";
import { fixPrisma } from "~/util/server";
import { ErrorTypes } from "~/util/types";

fixPrisma();

export default async function (req: NextApiRequest, res: NextApiResponse) {
if (req.method !== "POST")
return res.status(405).json({ message: "Method Not Allowed" });
Expand Down
13 changes: 13 additions & 0 deletions util/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from "path";

// https://github.com/Ovyerus/prisma-sdk-vercel-repro/pull/1/commits/a01508e8980426b18be690d386c9ffddaaa472e6
export const fixPrisma = () => {
path.join(
process.cwd(),
"node_modules/@prisma/engines/query-engine-rhel-openssl-1.0.x"
);
path.join(
process.cwd(),
"node_modules/@prisma/engines/query-engine-windows.exe"
);
};

0 comments on commit 01386ef

Please sign in to comment.