Replies: 1 comment
-
Hey @fofoy — certain aspects of Payload's email service in particular are still very relevant in contexts outside of Next.js. For example, the Local API methods of If you want to configure your own Payload instance to start up with specific things turned on / off, you can always do that with environment variables and by making your config dynamic, where it is constructed differently in certain contexts vs. others. For example, with that approach, you could only add your email adapter when you want to. Same with the Sentry plugin. I don't think there's much that we can do here though outside of that. I will convert this to a discussion though and will try and keep an eye on things as they progress here. |
Beta Was this translation helpful? Give feedback.
-
Describe the Bug
I reported some time ago about a problem when using
getPayload
method outside of Next.js generating importMap outside Next.js when it was not needed and it was actually causing problems. This issue was kindly fixed by @r1tsuu but this didn't resolve the other issue I had which is that when I'm invokinggetPayload
method outside Next.js, it's trying to deal with some email stuff from mypayload.config.ts
that I'm importing.Of course this is not needed at all when we just want to consume the Local API and generates errors in the console of the application that's consuming the Local API. Here is a sample log from my app :
In a more general way, it seems like when we use Payload from outside Next.js, it's trying to do way more things that we'd like to, especially when you just want to consume the Local API. (e.g Sentry stuff).
I don't know if something can be done to opt-out some plugins to be used only in Payload for example.
Link to the code that reproduces this issue
https://github.com/fofoy/payload-getPayload-outside-nextjs
Reproduction Steps
1 - Clone repo
2 - Run command
pnpm install
3 - Run command
docker run -d --name payload-monorepo -p 27017:27017 mongo
to spin up a new MongoDB instance4 - Run command
pnpm run dev
to start the apps in the monorepo5 - Go to the next application URL, it should be
http://localhost:3001
6 - Check out
next#dev
task and you should see following logs about email adapter not being providedand also Sentry logs
Which area(s) are affected? (Select all that apply)
area: core, email-nodemailer, plugin: sentry
Environment Info
Beta Was this translation helpful? Give feedback.
All reactions