Errors with preview environment

When I push code to my dev branch, vercel builds it correctly and deploys in the preview environment, but if I try to access it via the domain it generates (MYAPP-git-dev-MYPROJECTS.vercel.app) I get an error saying:

Application error: a server-side exception has occurred while loading MYAPP-git-dev-MYPROJECTS.vercel.app (see the server logs for more information).

The server logs show this error:

⨯ TypeError: Cannot read properties of null (reading ‘user’)
at v (.next/server/app/(app)/app/page.js:2:15068) {
digest: ‘951891281’
}

If I then merge this in my main branch, it deploys in my production environment, and I access my production URL it all works fine. Can anybody help me figure out why I cannot access the preview deployment?

I figured this… ONE of my environment variables was not available in the preview environment which caused the problem. Once I set it up correctly it all worked :slight_smile:

1 Like

Thanks for posting your solution, it really helps other folks who find the thread

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.