Skip to content

Conversation

@Karlos97
Copy link

Summary
While setting up a Payload project using the following steps:

  1. Run pnpx create-payload-app@latest.
  • Template: website
  • Database: MongoDB
  1. Start the app with yarn dev.
  2. Create an account and populate the database using the default seed.

The application successfully initializes with default posts and pages. However, an issue arises when navigating to pages in both normal preview and live preview after removing all users except the one created during setup. The following error is displayed:
image

Problem
Upon investigation, the issue stems from the populateAuthors.ts file. Payload does not currently handle the case where a deleted user is still referenced in posts. This causes a failure when attempting to interact with the pages, especially when adding an archive block.

Since I'm new to Payload, I reviewed the seed files but couldn't identify any related issues. Additionally, I couldn't find a similar issue reported in the existing PRs.

Solution
I added error handling in the populateAuthors.ts file to gracefully manage cases where a deleted user is referenced. After implementing this fix, the application no longer crashes, and the pages render correctly.

Updated behavior:
image

Request for Review
Please let me know if I’ve missed anything or if there are additional steps I should take to ensure this fix aligns with the Payload project’s conventions.

@Karlos97 Karlos97 changed the title fix(website): Add error handling to populateAuthors fix: Add error handling to populateAuthors Jan 17, 2025
@Karlos97 Karlos97 changed the title fix: Add error handling to populateAuthors fix: add error handling to populateAuthors Jan 17, 2025
@Karlos97 Karlos97 force-pushed the fix/add-error-handling-in-website-populate-authors branch from 0805f02 to 0561d96 Compare January 17, 2025 21:29
@Karlos97 Karlos97 force-pushed the fix/add-error-handling-in-website-populate-authors branch from 6232c73 to 0561d96 Compare January 20, 2025 16:54
@Karlos97
Copy link
Author

Karlos97 commented Feb 5, 2025

@denolfe This ticket has low priority, but I'd like to know if I should close it, or we're ready to merge.

@github-actions github-actions bot added the stale label Mar 8, 2025
@github-actions github-actions bot removed the stale label Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant