fix(cms): make the admin panel usable in a deployed container #142
Closed
tudor
wants to merge 1 commits from
fix/payload-initial-migration into main
pull from: fix/payload-initial-migration
merge into: tudor:main
tudor:main
tudor:fix/school-page-selective-flag
tudor:feat/header-facts-and-flags
tudor:fix/la-average-cached-failure
tudor:fix/search-row-facts
tudor:fix/header-nursery-and-gender
tudor:feat/phase-order-child-path
tudor:fix/desktop-clear-keeps-search
tudor:fix/modal-close-tap-target
tudor:feat/single-state-school-group
tudor:feat/school-type-groups-faith
tudor:fix/filter-options-not-from-results
tudor:feat/mobile-filter-sheet
tudor:fix/e2e-after-half-mile-default
tudor:fix/map-popup-view-button
tudor:fix/default-radius-half-mile
tudor:fix/toolbar-one-line
tudor:fix/phase-filter-exact-match
tudor:fix/phase-filter-global
tudor:fix/map-pane-header
tudor:feat/map-list-rows
tudor:fix/phone-toolbar-width
tudor:feat/results-map-view
tudor:feat/results-toolbar
tudor:feat/compare-limit-per-phase
tudor:copy/remove-em-dashes
tudor:fix/jump-sheet-under-bottom-bar
tudor:fix/nearby-journey-waits-for-smooth-scroll
tudor:fix/nearby-scroll-journey-clicks-offscreen-card
tudor:fix/nearby-schools-order-by-distance
tudor:feat/similar-schools-nearby
tudor:fix/release-check-diagnostics
tudor:feat/release-identity-and-reliability-gate
tudor:docs/current-truth-and-legacy-inventory
tudor:fix/og-image-route-group
tudor:feat/school-page-place-links
tudor:feat/about-blog-flags
tudor:fix/payload-import-map
tudor:feat/about-and-blog
tudor:fix/destinations-national-grain
tudor:fix/airflow-fixed-admin-password
tudor:feat/ks4-destinations
tudor:fix/dark-mode-map-popup-contrast
tudor:fix/distance-flag-off-absence-copy
tudor:fix/navigation-source-soft-nav
tudor:feat/place-school-attributes
tudor:feat/place-analytics
tudor:fix/mobile-hero-search
tudor:fix/suggest-reopens-over-results
tudor:fix/dark-map-fade
tudor:fix/hero-dropdown-clipping
tudor:feat/school-autosuggest
tudor:fix/flags-runbook
tudor:feat/feature-flags
tudor:fix/place-phase-links
tudor:feat/place-alphabetical-sort
tudor:fix/e2e-canonical-and-robots
tudor:feat/place-multiple-authorities
tudor:fix/place-table-alignment
tudor:fix/place-presentation-to-main
tudor:fix/place-title-brand-doubling
tudor:fix/place-page-presentation
tudor:fix/place-phase-variants
tudor:fix/locality-collision-skip
tudor:feat/w2-location-layer
tudor:feat/seo-metadata-c1
tudor:fix/sitemap-any-year-data
tudor:fix/staging-noindex
tudor:feat/seo-crawl-hygiene-main
tudor:feat/hero-artwork
tudor:fix/homepage-truth-and-rhythm-main
tudor:feat/brand-logo-artwork
tudor:fix/homepage-truth-and-rhythm
tudor:feat/schoolcompare-brand
tudor:feat/detail-gias-fields-remove-unwired
tudor:fix/special-schools-not-failing
tudor:fix/detail-allthrough-admissions-phase
tudor:fix/expert-signoff-shouldfixes
tudor:fix/gias-blank-name-codes
tudor:feat/compare-api-enrichment
tudor:feat/gias-code-dictionaries
tudor:feat/compare-chart-mobile-readability
tudor:feat/pr-comment-agent
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Two bugs that each made the CMS unusable outside the throwaway database it was developed against. Both were silent in different ways.
The container had no tables
Staging failed on boot with
42P01, relation "payload.users" does not exist. No migration existed, and the adapter cannot create tables itself:db-postgres/connect.jsgates push onNODE_ENV !== 'production', so it is inert in a deployed container regardless of config.The generated migration is schema-qualified to
payloadthroughout but does not create that schema.schemaNamesays where tables go, it does not create anything. It only worked against the database used to generate it because the schema had been created there by hand, so every real environment would have failed on the first statement.CREATE SCHEMA IF NOT EXISTSis hand-added at the top ofup(), which makes it exactly the kind of edit a regeneration discards silently, so a test asserts it is present and ordered before the firstCREATE TABLE.payload-types.tsis now committed rather than ignored. Ignoring it meant CI typechecked against looser types than a developer with a generated copy, which is how aRecord<string, unknown>cast passed CI and then failed locally the moment the file appeared.The Content field did not render
Creating a post showed no Content editor, and saving then failed validation on a field the writer was never shown.
The admin panel does not import field components. The server hands the client a path per field and resolves it through the generated map at
app/(payload)/admin/importMap.js; a richText field's is@payloadcms/richtext-lexical/rsc#RscEntryLexicalField. The committed map held a single entry,@payloadcms/next/rsc#CollectionCards, generated before the blog collections existed and never re-run. A path missing from the map is not an error the panel reports. The field simply does not render, whilerequiredis still enforced server-side on save.next builddoes not regenerate the map, so the stale copy shipped in the image and the editor was equally broken on staging and production.Regenerating adds the lexical RSC field, cell and diff components,
BlocksFeatureClientfor the Callout block, and the default toolbar features. Two things stop it drifting again: there was no script to run, sopackage.jsongetsgenerate:importmap, and a test asserts the map carries an entry for each thing the config asks for. Against the old map all five of those tests fail.Verification
tsc --noEmitclean.__tests__/payload/suites.next buildsucceeds withDATABASE_URLunset, as CI builds it.No
e2e/change. The journeys cover the public blog and assert/adminis noindex; the authenticated editor is not reachable from them, and no public behaviour changes here. The real proof is creating a post in the staging panel once this is deployed.🤖 Generated with Claude Code
https://claude.ai/code/session_01DXnXQKnPpZBBP61fBQiFkq
🤖 AI Code Review (Claude Code)
This PR documents the Payload admin import-map gotcha (a missing entry silently drops a field's editor while server-side
requiredstill blocks saving), adds a regression test that greps importMap.js and Posts.ts to catch drift, adds agenerate:importmapnpm script, and includes the regenerated importMap.js with all the richtext-lexical RSC/client feature entries. Verified the test's file paths resolve correctly and its assertions (richText field, drafts:true, BlocksFeature usage) match the current Posts.ts content, so the test is correct and will pass. No correctness, security, or deploy issues found.✅ No issues found.
Pull request closed