sofn-xyz / mailing

Build, test, send emails with React
https://www.mailing.run
MIT License
3.61k stars 72 forks source link

Is Prisma a requirement? #491

Open wollardj opened 11 months ago

wollardj commented 11 months ago

Describe the bug I enjoy using Prisma, but the Remix project I'm currently working on doesn't make use of it. This is the error encountered when trying to send an email:

 ✓ Compiled /api/sendMail in 90ms (380 modules)
 ⨯ PrismaClientInitializationError: Your schema.prisma could not be found, and we detected that you are using Next.js.
Full stack trace ``` ✓ Compiled /api/sendMail in 90ms (380 modules) ⨯ PrismaClientInitializationError: Your schema.prisma could not be found, and we detected that you are using Next.js. Find out why and learn how to fix this: https://pris.ly/d/schema-not-found-nextjs at constructor (webpack://mailing/prisma/generated/client/runtime/library.js?c464:106:2362) at getEngine (webpack://mailing/prisma/generated/client/runtime/library.js?c464:177:6135) at constructor (webpack://mailing/prisma/generated/client/runtime/library.js?c464:177:5719) at eval (webpack://mailing/prisma/index.ts?a5ca:8:43) at Module.(api)/./prisma/index.ts (/redacted/path/.mailing/.next/server/pages/api/sendMail.js:372:1) at __webpack_require__ (/redacted/path/.mailing/.next/server/webpack-api-runtime.js:33:43) at eval (webpack-internal:///(api)/./src/util/validate/validateApiKey.ts:6:65) at Module.(api)/./src/util/validate/validateApiKey.ts (/redacted/path/.mailing/.next/server/pages/api/sendMail.js:442:1) at __webpack_require__ (/redacted/path/.mailing/.next/server/webpack-api-runtime.js:33:43) at eval (webpack-internal:///(api)/./src/pages/api/sendMail.ts:7:87) at Module.(api)/./src/pages/api/sendMail.ts (/redacted/path/.mailing/.next/server/pages/api/sendMail.js:392:1) at __webpack_require__ (/redacted/path/.mailing/.next/server/webpack-api-runtime.js:33:43) at eval (webpack-internal:///(api)/../node_modules/next/dist/build/webpack/loaders/next-route-loader/index.js?kind=PAGES_API&page=%2Fapi%2FsendMail&preferredRegion=&absolutePagePath=.%2Fsrc%2Fpages%2Fapi%2FsendMail.ts&middlewareConfigBase64=e30%3D!:11:84) at Module.(api)/../node_modules/next/dist/build/webpack/loaders/next-route-loader/index.js?kind=PAGES_API&page=%2Fapi%2FsendMail&preferredRegion=&absolutePagePath=.%2Fsrc%2Fpages%2Fapi%2FsendMail.ts&middlewareConfigBase64=e30%3D! (/redacted/path/.mailing/.next/server/pages/api/sendMail.js:342:1) at __webpack_require__ (/redacted/path/.mailing/.next/server/webpack-api-runtime.js:33:43) { clientVersion: '4.16.2', errorCode: undefined } ✓ Compiled /_error in 155ms (688 modules) mailing 500 /api/sendMail 928ms ```

Also worth noting, I'm actually not using Next.js (though that's not the worst guess given it's actually Remix)

To Reproduce Steps to reproduce the behavior:

  1. setup the project as described in Getting Started
  2. apply Remix-specific modifications as described in Remix Integration
  3. add a simple api route to test sending emails (se code snippet below for example content)
  4. visit /email
  5. click "Force send" when Mailing intercepts the send attempt
  6. see the error in the server output
// app/routes/email.ts

import sendMail from "~/emails/send-mail.server";

export async function loader() {
  const result = await sendMail({
    subject: "A test email",
    to: "example@example.com",
    text: "Will this work? Seems like it should be pretty basic",
    html: "<p>Will this work? Seems like it should be pretty basic</p>",
  });

  return result ? result : "error";
}

Expected behavior The email should send

Desktop (please complete the following information):

Additional context I've tried setting up transports for sendmail and postmark with no changes in behavior.

Horia73 commented 3 months ago

any solution to this? I am encountering same issue