#Changing the project structure - Error 404

3 messages · Page 1 of 1 (latest)

meager ledge
#

I am creating a site that includes next-intl for i18n, which requires me to have this structure:

  • src
    -- app
    --- [locale]
    ---- (frontend)
    ---- (payload)
    The reason why this structure is required is because i am using no prefix for my default language and a prefix for my second language.
    If i dont do this structure i can not get to the admin page.

With the above I can get into my admin panel, and change locale with next-intl on my frontend. Good!
/[locale]/admin/[[...segments]] is the route for my admin panel.

I am however, getting two errors

  1. 404 not found error when i now create a post or anything post related in the admin panel. This did not happen before i changed the structure.
GET http://localhost:3000/api/payload-preferences/locale 404 (Not Found)

&

C:\Users\myUser\Documents\GitHub\ck-monorepo\node_modules\.pnpm\@payloadcms+ui@3.2.1_monaco-editor@0.52.0_next@15.0.3_@babel+core@7.25.8_babel-plugin-macros@_qe2wusko6k34r2edboot6ullva\node_modules\@payloadcms\ui\dist\exports\client\index.js:48 
POST http://localhost:3000/api/partners?depth=0&fallback-locale=null&locale=en 404 (Not Found)
Generating import map
[Function (anonymous)]
 ⨯ ..\..\node_modules\.pnpm\payload@3.2.1_graphql@16.9.0_monaco-editor@0.52.0_react-dom@19.0.0-rc-65a56d0e-20241020_react_jqjkbuafwviv24bimp3tgs6jda\node_modules\payload\dist\bin\generateImportMap\index.js (81:1) @ addToImportMap
 ⨯ Internal error: Error: addToImportMap > Payload component must be an object or a string
editor@0.52.0_next@15.0.3_@babel+core@7.25.8_bab_cqhr3ayhe2cureb5eipykt5j5q/node_modules/@payloadcms/next/dist/layouts/Root/index.js:66:21)
digest: "4148784728"
  79 |         if (typeof payloadComponent !== 'object' && typeof payloadComponent !== 'string') {
  80 |             console.error(payloadComponent);
> 81 |             throw new Error('addToImportMap > Payload component must be an object or a string');
     | ^

Does anyone have any idea what is going wrong and how i can fix it?

meager ledge
#

Additional errors:

GET http://localhost:3000/api/payload-preferences/nav 404 (Not Found)
GET http://localhost:3000/api/payload-preferences/undefined 404 (Not Found)