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

create-payload-app in existing Next.js project replaces .env and .env.example contents #10355

Open
smoores-dev opened this issue Jan 4, 2025 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@smoores-dev
Copy link

Describe the Bug

On the tin! I had a .env file with several variables in it; after running npx create-payload-app, the entire contents were replaced with:

# Added by Payload
DATABASE_URI=your-database-uri
PAYLOAD_SECRET=your-payload-secret
POSTGRES_URL=<postgres-url>

Link to the code that reproduces this issue

https://github.com/smoores-dev/payload-dotenv-clear-repro

Reproduction Steps

You can just see the issue by looking at the .env.example file between the two commits in that repo. To reproduce:

  1. git checkout init to check out the initial commit
  2. Add a .env file and put an environment variable in it
  3. npx create-payload-app (choose whatever options)
  4. Observe the replaced content in the .env.example file and .env file

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

Not sure

Environment Info

Binaries:
  Node: 22.10.0
  npm: 10.9.0
  Yarn: 4.5.0
  pnpm: N/A
Relevant Packages:
  payload: 3.14.0
  next: 15.1.3
  @payloadcms/email-nodemailer: 3.14.0
  @payloadcms/graphql: 3.14.0
  @payloadcms/next/utilities: 3.14.0
  @payloadcms/payload-cloud: 3.14.0
  @payloadcms/richtext-lexical: 3.14.0
  @payloadcms/translations: 3.14.0
  @payloadcms/ui/shared: 3.14.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Dec 15 16:48:23 UTC 2024
  Available memory (MB): 64001
  Available CPU cores: 16
@smoores-dev smoores-dev added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant