Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPayload tries to deal with email even outside Next.js #10046

Open
fofoy opened this issue Dec 18, 2024 · 0 comments
Open

getPayload tries to deal with email even outside Next.js #10046

fofoy opened this issue Dec 18, 2024 · 0 comments
Labels
created-by: Contributor status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@fofoy
Copy link
Contributor

fofoy commented Dec 18, 2024

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 invoking getPayload method outside Next.js, it's trying to deal with some email stuff from my payload.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 :

Image

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).

Image

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 instance
4 - Run command pnpm run dev to start the apps in the monorepo
5 - 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 provided

Image

and also Sentry logs

Image

Which area(s) are affected? (Select all that apply)

area: core, email-nodemailer, plugin: sentry

Environment Info

Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 9.6.0
Relevant Packages:
  payload: 3.6.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 11967
  Available CPU cores: 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
created-by: Contributor status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant