Hi. After changing payload.config settings to include globals I'm receiving an Internal Server error 500 at localhost:3000.
Any ideas? The config file looks fine. No errors are returning in the terminal.
Here's the repo:
https://github.com/taunhealy/2160-Lodge-Bukela-2 import { buildConfig } from 'payload/config';
import dotenv from 'dotenv';
import Page from './collections/Page';
import Media from './collections/Media';
import Portfolio from './collections/Portfolio';
import MegaMenu from './globals/MegaMenu';
import SocialMedia from './globals/SocialMedia';
import Footer from './globals/Footer';
dotenv.config();
export default buildConfig({
serverURL: process.env.PAYLOAD_PUBLIC_SERVER_URL,
collections: [
Page,
Media,
Portfolio,
],
globals: [
MegaMenu,
SocialMedia,
Footer,
],
});
GET http://localhost:3000/_next/static/chunks/fallback/main.js?ts=1680165083579 net::ERR_ABORTED 500 (Internal Server Error)
localhost/:1 GET http://localhost:3000/_next/static/chunks/fallback/pages/_app.js?ts=1680165083579 net::ERR_ABORTED 500 (Internal Server Error)
localhost/:1 GET http://localhost:3000/_next/static/chunks/fallback/pages/_error.js?ts=1680165083579 net::ERR_ABORTED 500 (Internal Server Error)
DevTools failed to load source map: Could not load content for chrome-extension://ppkojackhibeogijphhfnamhemklmial/js/page.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
favicon.ico:1 GET http://localhost:3000/favicon.ico 500 (Internal Server Error)
Internal Server Error 500
hey @Taun i think i have similar issue. well what works for me is to delete node module and install them again. (weird i know haha)
Thanks @Kris . I opened the project on a different PC and the console returned this error:
Server Error
TypeError: Cannot read properties of undefined (reading 'slug')
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
pages\[...slug].tsx (63:48) @ slug
61 |
62 | export const getServerSideProps: GetServerSideProps = async (ctx) => {
> 63 | const slug = 'ctx.params?.slug' ? (ctx.params.slug as string[]).join('/') : 'home';
| ^
64 |
65 | const pageQuery = await payload.find({
66 | collection: 'pages',
Call Stack
func
pages\index.tsx (8:9)
Show collapsed frames
The problem was that my slug was stored as a string, so I removed the ' ' and it works now.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.