Docs in English (part 1), seeding guide, Coolify deployment
- Translate to English every doc the code branches did not touch: AGENT.md, developer guide, vibe, CHANGELOG, docs index, module pages, all skills except ipal-seo-check (14 pages follow after the security/SEO merge). Placeholder marker is now [TO FILL: …]; skill resources renamed to section-code.md / nav-code.md. AGENT.md and the ipal-skills pointer block say the docs are in English. - docs/seeding.md: create-only, natural keys, never delete, no users or secrets, empty-field globals, fallbackLocale: false, dry run, backup and restore, production update guard, seeds vs migrations, Coolify Terminal. Seed templates gain --dry-run, the SEED_UPDATE production guard (IPAL_SEED_ALLOW_PROD_UPDATE), skip of edited records and a summary. "Seeding on production" rule block in AGENT.md. - Coolify is the single deployment path (deployment, env, developer guide, ipal-setup): build vs runtime env, migrations on container start (prodMigrations), health check and rolling updates, rollback, backups and restore, DNS/Let's Encrypt/CAA. R2: custom domain needs a Cloudflare zone; default is media served by the app (R2_PUBLIC_URL empty). - docsConsistency: no Polish prose outside code/quoted data (pending pages listed); IPAL_* names may also be read by shipped skill templates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6e3979bae6
commit
2d9f3e15d4
@@ -5,94 +5,94 @@ description: Systematic diagnosis for ipal-kit / Payload 3 / Next 16 projects
|
||||
|
||||
# ipal-debug
|
||||
|
||||
Nie zgaduj, nie przepisuj na ślepo, nie pytaj użytkownika, zanim nie przejdziesz
|
||||
tej procedury. Pytasz tylko, gdy brakuje czegoś, czego nie możesz uzyskać sam
|
||||
(sekret, dostęp do panelu produkcji, decyzja biznesowa).
|
||||
Do not guess, do not rewrite blindly, and do not ask the user before you have gone
|
||||
through this procedure. Ask only when you are missing something you cannot get yourself
|
||||
(a secret, access to the production admin panel, a business decision).
|
||||
|
||||
## Procedura
|
||||
1. **Odtwórz** — dokładna komenda / URL / klik, pełny komunikat (pierwszy błąd w
|
||||
logu, nie ostatni). Dev i build zachowują się inaczej — sprawdź oba, jeśli dotyczy renderingu/SEO.
|
||||
2. **Zawęź warstwę**:
|
||||
| Pytanie | Jak sprawdzić |
|
||||
## Procedure
|
||||
1. **Reproduce** — the exact command / URL / click, the full message (the first error in
|
||||
the log, not the last). Dev and build behave differently — check both if it concerns rendering/SEO.
|
||||
2. **Narrow down the layer**:
|
||||
| Question | How to check |
|
||||
|---|---|
|
||||
| kod projektu? | `git diff`/`git stash` → czy błąd znika |
|
||||
| konfiguracja? | `payload.config.ts`, `next.config.ts`, `proxy.ts`, `.env` vs `docs/env.md` |
|
||||
| dane w panelu? | ta sama strona w innym języku / inny dokument działa? `Save` kliknięty? |
|
||||
| środowisko? | `rm -rf .next`, restart dev, `pnpm install`, wersje: `pnpm why @payloadcms/ui` |
|
||||
| ipal-kit? | błąd w `node_modules/@intecion/ipal-kit/dist/…`, zachowanie niezgodne z `docs/<moduł>.md` |
|
||||
3. **Tabela niżej** — większość błędów już się zdarzyła.
|
||||
4. **Napraw przyczynę**, nie objaw (`as any`, `try/catch` połykający błąd,
|
||||
`force-dynamic` „żeby działało”, kopia kodu pluginu do projektu = **nie**).
|
||||
5. **Udowodnij**: ta sama komenda z kroku 1 przechodzi + `ipal-audit --quick` +
|
||||
(rendering/SEO) `ipal-seo-check` na buildzie.
|
||||
6. Błąd po stronie ipal-kit → obejście w projekcie **tylko jeśli jest czyste i
|
||||
oznaczone** (`// WORKAROUND ipal-kit <wersja>: <opis>`) + raport **ipal-plugin-gap**.
|
||||
Zapisz przypadek w `AGENTS.md` → „Ustalenia projektu”, jeśli wróci.
|
||||
| project code? | `git diff`/`git stash` → does the error go away |
|
||||
| configuration? | `payload.config.ts`, `next.config.ts`, `proxy.ts`, `.env` vs `docs/env.md` |
|
||||
| panel data? | does the same page in another language / another document work? Was `Save` clicked? |
|
||||
| environment? | `rm -rf .next`, restart dev, `pnpm install`, versions: `pnpm why @payloadcms/ui` |
|
||||
| ipal-kit? | error in `node_modules/@intecion/ipal-kit/dist/…`, behaviour that contradicts `docs/<module>.md` |
|
||||
3. **The table below** — most errors have happened before.
|
||||
4. **Fix the cause**, not the symptom (`as any`, a `try/catch` that swallows the error,
|
||||
`force-dynamic` "to make it work", copying plugin code into the project = **no**).
|
||||
5. **Prove it**: the same command from step 1 passes + `ipal-audit --quick` +
|
||||
(rendering/SEO) `ipal-seo-check` on the build.
|
||||
6. Bug on the ipal-kit side → a workaround in the project **only if it is clean and
|
||||
marked** (`// WORKAROUND ipal-kit <version>: <description>`) + an **ipal-plugin-gap** report.
|
||||
Record the case in `AGENTS.md` → "Project decisions" if it may come back.
|
||||
|
||||
## Objaw → przyczyna → naprawa
|
||||
## Symptom → cause → fix
|
||||
|
||||
### Build / TypeScript
|
||||
| Objaw | Przyczyna | Naprawa |
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| `TS2307 next/navigation` w `dist` pluginu | import bez `.js` w kliencie pluginu (NodeNext) | **bug ipal-kit** → plugin-gap; plugin importuje `'next/navigation.js'` |
|
||||
| `TS2307 @payloadcms/storage-s3` | brak pakietu przy `buildR2Storage` | `pnpm add @payloadcms/storage-s3` + `buildR2Storage(['media'], { s3Storage })` |
|
||||
| `does not provide an export named X` / `X is not a function` | symbol nie wyeksportowany z entry pointu albo zły subpath (`/client` vs root vs `/server` vs `/rsc`) | `docs/README.md` → właściwy import; brak w każdym entry → **bug ipal-kit** (eksport) |
|
||||
| `Cannot find module '@clocklimited/payload-2fa'` | brak wstrzyknięcia | `twoFactor: { plugin: payloadTotp }` (`serverExternalPackages` nie pomaga — pada na `.css`) |
|
||||
| `TS2322` przy `plugin: payloadTotp` (`string` vs `CollectionSlug`) | ipal-kit ≤ 1.8.13 typował `collection` jako `string` | zaktualizuj ipal-kit; usuń adapter/rzutowanie |
|
||||
| `Page changed from static to dynamic at runtime` | `headers()`, `cookies()`, `searchParams` w drzewie strony (często `not-found.tsx`) | locale z `params`; `not-found` → `LocaleView` (pages.md); `headers()` tylko w server actions / route handlers |
|
||||
| trasy `ƒ` mimo `generateStaticParams` | build nie widzi bazy | `DATABASE_URI` w buildzie (PROGRAMISTA §4.3) |
|
||||
| build pada `ENOTFOUND` / Mongoose | trasa czyta bazę w buildzie bez bazy | trasy czytające bazę (sitemap.xml, manifest, llms.txt, llms-full.txt, api/health): `export const dynamic = 'force-dynamic'` (tylko one, nie strony) |
|
||||
| `slug.join is not a function` | `[slug]` zamiast `[[...slug]]` | zmień nazwę folderu |
|
||||
| `Missing <html> and <body>` | layout `[locale]` bez `<html>` po usunięciu root layoutu | `<html lang>` i `<body>` w `[locale]/layout.tsx` |
|
||||
| `Export fileTypeFromFile doesn't exist in target module` (Turbopack, start dev) | `instrumentation.ts` importuje z roota pakietu → Payload w bundlu Edge | import z `@intecion/ipal-kit/env` + `NEXT_RUNTIME === 'nodejs'` (env.md) |
|
||||
| `R2_PUBLIC_URL must be a valid URL (got "/media")` | stara wersja reguły / produkcja ze ścieżką względną | dev: `/media` dozwolone od nowej wersji; produkcja: pełny URL domeny bucketu |
|
||||
| `server-only` w kliencie | import z `@intecion/ipal-kit/server` w `'use client'` | wywołuj przez server action |
|
||||
| `TS2307 next/navigation` in the plugin's `dist` | import without `.js` in the plugin client (NodeNext) | **ipal-kit bug** → plugin gap; the plugin imports `'next/navigation.js'` |
|
||||
| `TS2307 @payloadcms/storage-s3` | package missing when using `buildR2Storage` | `pnpm add @payloadcms/storage-s3` + `buildR2Storage(['media'], { s3Storage })` |
|
||||
| `does not provide an export named X` / `X is not a function` | symbol not exported from the entry point, or wrong subpath (`/client` vs root vs `/server` vs `/rsc`) | `docs/README.md` → the right import; missing from every entry → **ipal-kit bug** (export) |
|
||||
| `Cannot find module '@clocklimited/payload-2fa'` | not injected | `twoFactor: { plugin: payloadTotp }` (`serverExternalPackages` does not help — it fails on `.css`) |
|
||||
| `TS2322` on `plugin: payloadTotp` (`string` vs `CollectionSlug`) | ipal-kit ≤ 1.8.13 typed `collection` as `string` | update ipal-kit; remove the adapter/cast |
|
||||
| `Page changed from static to dynamic at runtime` | `headers()`, `cookies()`, `searchParams` in the page tree (often `not-found.tsx`) | locale from `params`; `not-found` → `LocaleView` (pages.md); `headers()` only in server actions / route handlers |
|
||||
| `ƒ` routes despite `generateStaticParams` | the build cannot see the database | `DATABASE_URI` in the build (PROGRAMISTA §4.3) |
|
||||
| build fails with `ENOTFOUND` / Mongoose | a route reads the database during a build without a database | routes that read the database (sitemap.xml, manifest, llms.txt, llms-full.txt, api/health): `export const dynamic = 'force-dynamic'` (only these, not pages) |
|
||||
| `slug.join is not a function` | `[slug]` instead of `[[...slug]]` | rename the folder |
|
||||
| `Missing <html> and <body>` | `[locale]` layout without `<html>` after the root layout was removed | `<html lang>` and `<body>` in `[locale]/layout.tsx` |
|
||||
| `Export fileTypeFromFile doesn't exist in target module` (Turbopack, dev start) | `instrumentation.ts` imports from the package root → Payload in the Edge bundle | import from `@intecion/ipal-kit/env` + `NEXT_RUNTIME === 'nodejs'` (env.md) |
|
||||
| `R2_PUBLIC_URL must be a valid URL (got "/media")` | old version of the rule / production with a relative path | dev: `/media` allowed since the new version; production: full URL of the media domain, or leave it empty (media through the app) and make the rule optional (env.md) |
|
||||
| `server-only` in the client | import from `@intecion/ipal-kit/server` in `'use client'` | call it through a server action |
|
||||
|
||||
### Panel (`/admin`)
|
||||
| Objaw | Przyczyna | Naprawa |
|
||||
### Admin panel (`/admin`)
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| `PayloadComponent not found in importMap` (np. `@intecion/ipal-kit/admin#RowLabel`) | importMap nieaktualny po aktualizacji pluginu / dodaniu `rowLabel` | `pnpm payload generate:importmap`, restart |
|
||||
| `Cannot destructure property 'config'` / hooki UI bez kontekstu | dwie kopie `@payloadcms/ui` | `pnpm why @payloadcms/ui`; jedna wersja + `pnpm.overrides`; `ls node_modules/@intecion/ipal-kit/node_modules/@payloadcms` = pusto |
|
||||
| pusty tab SEO, brak Forms | rozjazd wersji `@payloadcms/*` | wszystkie `@payloadcms/*` = wersja `payload` |
|
||||
| upload odrzucony „Image is … Tick Optimize” | `buildOptimizeUploadHook` (zamierzone) | zaznacz checkbox albo przygotuj plik; limit w opcjach hooka |
|
||||
| upload wideo odrzucony | limit `maxVideoBytes` | eksport wg komunikatu (H.264, 720–1080p, fast start) |
|
||||
| zmiana w panelu niewidoczna | brak Save / ISR bez rewalidacji | kolekcja: `buildRevalidateHook`; global (Header, Footer…): własny `afterChange` z `revalidatePath('/', 'layout')` (ipal-nav) — globali pluginu (Site Settings, Cookie Settings, Notifications) plugin nie rewaliduje (raport ipal-plugin-gap): czeka do końca okna `revalidate`; doraźnie dopisz im `afterChange` własnym pluginem po `ipalKit` w `plugins` (modyfikuje `config.globals`) |
|
||||
| `PayloadComponent not found in importMap` (e.g. `@intecion/ipal-kit/admin#RowLabel`) | importMap out of date after a plugin update / adding `rowLabel` | `pnpm payload generate:importmap`, restart |
|
||||
| `Cannot destructure property 'config'` / UI hooks without context | two copies of `@payloadcms/ui` | `pnpm why @payloadcms/ui`; one version + `pnpm.overrides`; `ls node_modules/@intecion/ipal-kit/node_modules/@payloadcms` = empty |
|
||||
| empty SEO tab, no Forms | mismatched `@payloadcms/*` versions | all `@payloadcms/*` = the `payload` version |
|
||||
| upload rejected "Image is … Tick Optimize" | `buildOptimizeUploadHook` (intended) | tick the checkbox or prepare the file; limit in the hook options |
|
||||
| video upload rejected | `maxVideoBytes` limit | export as the message says (H.264, 720–1080p, fast start) |
|
||||
| change in the panel not visible | no Save / ISR without revalidation | collection: `buildRevalidateHook`; global (Header, Footer…): your own `afterChange` with `revalidatePath('/', 'layout')` (ipal-nav) — the plugin does not revalidate its own globals (Site Settings, Cookie Settings, Notifications) (ipal-plugin-gap report): the change waits until the `revalidate` window ends; as a stopgap add an `afterChange` to them with your own plugin placed after `ipalKit` in `plugins` (it modifies `config.globals`) |
|
||||
|
||||
### Front / routing / SEO
|
||||
| Objaw | Przyczyna | Naprawa |
|
||||
### Front end / routing / SEO
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| `/pl` → 404 | Homepage nieprzypisany w System Pages | ustaw w panelu |
|
||||
| `/en/*` → 404, `/pl/*` działa | brak sluga/tytułu w EN | `ipal-locale-add` → `locale-coverage` |
|
||||
| przełącznik języka → 404 | podmiana prefiksu zamiast `AlternateLinksUpdater` | i18n.md → AlternateLinks |
|
||||
| metadata w `<body>` (seo-check) | streaming: brak `htmlLimitedBots`, jawny `<head>`, dynamiczna strona | AGENT §4; `generatePageMetadata` |
|
||||
| canonical / sitemap z localhost | `NEXT_PUBLIC_SERVER_URL` nieustawione w buildzie | ustaw w env buildu (nie tylko runtime) |
|
||||
| `/admin`, `/_next` → 500 lub pętla | matcher proxy nie jest literałem | matcher inline w `proxy.ts` |
|
||||
| hydration mismatch przy banerze | odczyt cookie/`window` w renderze | consent tylko przez `CookieBanner`/`useConsentContext`; `Date`, `Math.random` poza renderem |
|
||||
| obrazy nie ładują się (R2) | brak domeny w `images.remotePatterns` / zły `R2_PUBLIC_URL` | `next.config.ts` + env (storage.md) |
|
||||
| 404 strona bez stylów/nav | `not-found.tsx` poza `[locale]` bez layoutu | pages.md — przykład `not-found` |
|
||||
| `/pl` → 404 | Homepage not assigned in System Pages | set it in the panel |
|
||||
| `/en/*` → 404, `/pl/*` works | slug/title missing in EN | `ipal-locale-add` → `locale-coverage` |
|
||||
| language switcher → 404 | prefix swap instead of `AlternateLinksUpdater` | i18n.md → AlternateLinks |
|
||||
| metadata in `<body>` (seo-check) | streaming: no `htmlLimitedBots`, explicit `<head>`, dynamic page | AGENT §4; `generatePageMetadata` |
|
||||
| canonical / sitemap with localhost | `NEXT_PUBLIC_SERVER_URL` not set in the build | set it in the build env (not only at runtime) |
|
||||
| `/admin`, `/_next` → 500 or a loop | the proxy matcher is not a literal | inline matcher in `proxy.ts` |
|
||||
| hydration mismatch on the banner | reading cookie/`window` during render | consent only through `CookieBanner`/`useConsentContext`; `Date`, `Math.random` outside render |
|
||||
| images do not load (R2) | media domain missing in `images.remotePatterns` / wrong `R2_PUBLIC_URL`; without `R2_PUBLIC_URL`: Media has no `access.read: () => true` → 403 on `/api/media/file/…` | `next.config.ts` + env, or Media access (storage.md) |
|
||||
| 404 page without styles/nav | `not-found.tsx` outside `[locale]` without a layout | pages.md — `not-found` example |
|
||||
|
||||
### Zgoda / analityka / formularze / mail
|
||||
| Objaw | Przyczyna | Naprawa |
|
||||
### Consent / analytics / forms / email
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| piksel przed zgodą (consent-check) | skrypt wpięty ręcznie (`<Script>`) | wyłącznie przez panel → `<Analytics>` (GA/GTM/piksele) albo `<ConsentScript>` (analytics.md, consent.md) |
|
||||
| baner bez stylów | Tailwind nie skanuje pluginu | `@source` na `node_modules/@intecion/ipal-kit/dist/**/*.js` (ścieżka względem pliku CSS, PROGRAMISTA §2.5) |
|
||||
| maile nie wychodzą | brak `email: mailAdapter()` / pusty transport / pusta zakładka Emails | email.md; Send test w panelu |
|
||||
| nadawca maila stary | cache klienta poczty | sprawdź surowe nagłówki |
|
||||
| formularz: `unknown_fields` | pole spoza definicji (honeypot nieusunięty) | `ipal-form` → actions.ts |
|
||||
| Turnstile zawsze odrzuca | log `[ipal] Turnstile …` mówi dlaczego: brak sekretu, `invalid-input-secret`, `timeout-or-duplicate` | turnstile.md → tabela; sekret w panelu albo `TURNSTILE_SECRET_KEY`; **nie** zapisuj sekretu kodem |
|
||||
| pixel before consent (consent-check) | script wired by hand (`<Script>`) | only through the panel → `<Analytics>` (GA/GTM/pixels) or `<ConsentScript>` (analytics.md, consent.md) |
|
||||
| banner without styles | Tailwind does not scan the plugin | `@source` on `node_modules/@intecion/ipal-kit/dist/**/*.js` (path relative to the CSS file, PROGRAMISTA §2.5) |
|
||||
| emails are not sent | no `email: mailAdapter()` / empty transport / empty Emails tab | email.md; Send test in the panel |
|
||||
| old email sender | mail client cache | check the raw headers |
|
||||
| form: `unknown_fields` | field outside the definition (honeypot not removed) | `ipal-form` → actions.ts |
|
||||
| Turnstile always rejects | the `[ipal] Turnstile …` log says why: no secret, `invalid-input-secret`, `timeout-or-duplicate` | turnstile.md → table; secret in the panel or `TURNSTILE_SECRET_KEY`; **do not** write the secret in code |
|
||||
|
||||
### Środowisko
|
||||
| Objaw | Przyczyna | Naprawa |
|
||||
### Environment
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| zmiana w pluginie niewidoczna | stara wersja w `node_modules` / `.next` | `pnpm add @intecion/ipal-kit@<wersja>`, `grep -c <symbol> node_modules/@intecion/ipal-kit/dist/...`, `rm -rf .next`, restart |
|
||||
| skille nieaktualne po aktualizacji | nie odświeżone | `pnpm exec ipal-skills` |
|
||||
| `ipal-skills: command not found` | ipal-kit ≤ 1.8.13 nie publikował `bin` | zaktualizuj ipal-kit |
|
||||
| „Kod dobry, zachowanie złe” | — | po kolei: restart dev → Save w panelu → dublet zależności → importmap → cache |
|
||||
| change in the plugin not visible | old version in `node_modules` / `.next` | `pnpm add @intecion/ipal-kit@<version>`, `grep -c <symbol> node_modules/@intecion/ipal-kit/dist/...`, `rm -rf .next`, restart |
|
||||
| skills out of date after an update | not refreshed | `pnpm exec ipal-skills` |
|
||||
| `ipal-skills: command not found` | ipal-kit ≤ 1.8.13 did not publish `bin` | update ipal-kit |
|
||||
| "Code is right, behaviour is wrong" | — | in order: restart dev → Save in the panel → duplicate dependency → importmap → cache |
|
||||
|
||||
## Kiedy to bug ipal-kit (raport, nie łatka w node_modules)
|
||||
- błąd wskazuje plik w `dist` pluginu i nie wynika z błędnego użycia API z dokumentacji;
|
||||
- zachowanie niezgodne z `docs/<moduł>.md`;
|
||||
- dokumentacja każe importować coś, czego entry point nie eksportuje;
|
||||
- ten sam boilerplate piszesz w drugim projekcie z rzędu (kandydat na moduł).
|
||||
Wtedy **ipal-plugin-gap**: objaw, minimalne odtworzenie, wersja, proponowana
|
||||
zmiana w pluginie, obejście użyte w projekcie. **Nigdy** nie edytuj `node_modules`.
|
||||
## When it is an ipal-kit bug (report, not a patch in node_modules)
|
||||
- the error points to a file in the plugin's `dist` and does not come from misusing the documented API;
|
||||
- behaviour contradicts `docs/<module>.md`;
|
||||
- the docs tell you to import something that the entry point does not export;
|
||||
- you are writing the same boilerplate in a second project in a row (a module candidate).
|
||||
Then **ipal-plugin-gap**: symptom, minimal reproduction, version, proposed
|
||||
change in the plugin, workaround used in the project. **Never** edit `node_modules`.
|
||||
|
||||
Reference in New Issue
Block a user