Unexpected token : export , in next-auth. Site crashes
Answered
Belgian Hare posted this in #help-forum
Belgian HareOP
Hi guys our production sitecrashed few hours ago and these are the console erros. It was working fine 2 hours ago, i rebuilt it with a new commit (totally unrelated to next-auth) and then the site's auth stopped working 😦
56 Replies
Belgian HareOP
I reverted to a commit from last month locally, i still get that same error, what could possibly cause this? is this related to some upstream change?
@Kawakawa sorry to ping you man! but do you know anything about this? our production site's on stake 😦
Kawakawa
@Belgian Hare Totally understand. I am actually supposed to be working right now, but let's try and take a look.
Can you send me the file in question?
@Kawakawa Can you send me the file in question?
Belgian HareOP
the node_modules/next.js... file?
Kawakawa
Yeah never-mind, just mis-read that 😂
Gimme a sec
Belgian HareOP
next auth doc says to configure
NEXTAUTH_URL but thats already configured at my end!Kawakawa
So I'm thinking that due to the error message in the last screen-shot, there is something wrong with your module handling.
What I mean by that is that you are using EcmaScript Module (ESM or 'ES6 Modules') syntax but your environment does not support it (for some reason)...
What I mean by that is that you are using EcmaScript Module (ESM or 'ES6 Modules') syntax but your environment does not support it (for some reason)...
@Kawakawa So I'm thinking that due to the error message in the last screen-shot, there is something wrong with your module handling.
What I mean by that is that you are using EcmaScript Module (ESM or 'ES6 Modules') syntax but your environment does not support it (for some reason)...
Belgian HareOP
weird, i didnt change anything related to this at all 😨
Kawakawa
Can I see your
tsconfig.json file, and your package.json?And also your
next.config.js file please.Kawakawa
Just paste it here using a code-block.
Easier for me that way.
Belgian HareOP
discord limited it
Kawakawa
Send it in 2 parts 

Belgian HareOP
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/prisma/*": ["prisma/*"],
"@/src/*": ["src/*"],
"@/components/*": ["src/components/*"],
"@/config/*": ["src/config/*"],
"@/hooks/*": ["src/hooks/*"],
"@/layouts/*": ["src/layouts/*"],
"@/lib/*": ["src/lib/*"],
"@/providers/*": ["src/providers/*"],
"@/sections/*": ["src/sections/*"],
"@/styles/*": ["src/styles/*"],
"@/utils/*": ["src/utils/*"]
},
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"src/pages/freelancer/dashboard/index.js",
"src/components/FreelancerDashboardComponent/viewjobs/index.js",
"src/components/JobPostModal/index.jsx",
"src/providers/jobListProvider.jsx",
"src/pages/api/freelancer/referfriend.js",
"prisma/services/freelancer/referalfriend.js",
"src/components/ReferFriend/index.js",
"src/components/SearchBar/SearchResults.jsx",
"src/components/Modals/ApplyJobModal/index.jsx",
"src/components/FreelancerDashboardComponent/RecommendedJobs/index.jsx"
],
"exclude": ["node_modules"]
}tsconfig.json
Kawakawa
Or use github gists
Belgian HareOP
module.exports = {
images: {
domains: [''],
},
compiler: {
styledComponents: true,
},
reactStrictMode: false,
};next.config.jsKawakawa
Try adding
"type": "module" to your package.json.Worth a shot as I don't see it
And then can I also see your entry point for next-auth?
gives me lots of errors
@Belgian Hare Click to see attachment
Kawakawa
So do what it says, and convert/rename
postcss.config.js into postcss.config.cjsKawakawa
Well I mean now you have more errors to work with 😂
Belgian HareOP
I didnt had to do all of these before tho!
it worked fine without the type module
Kawakawa
Well, something is probably causing an issue...
But if you want to ignore it and go back, sure.
@Belgian Hare Try doing
pnpm update (or whatever you use)@Kawakawa <@600704648038580235> Try doing `pnpm update` (or whatever you use)
Belgian HareOP
did, no luck!
anyways thanks for the help, I'll go now, almost 1 am here. will ask my senior dev to look into this issue 😪 . If you ever come across a vim related issue, ping me up.
Belgian HareOP
@Kawakawa this fixed it man
Answer
Belgian HareOP
so it was an upstream issue after all, just removed the caret ^ from version number in package.json
@Belgian Hare next auth doc says to configure `NEXTAUTH_URL` but thats already configured at my end!
Southern rough shrimp
Did u set env variables in vercel
Oh nvm u fixed it
@Southern rough shrimp Did u set env variables in vercel
Belgian HareOP
your site looks pretty dope btw
@Belgian Hare your site looks pretty dope btw
Southern rough shrimp
Which ones
@Southern rough shrimp Which ones
Belgian HareOP
legions.dev
your UI design looks very beautiful too!
did you take any course or something :0
@Belgian Hare did you take any course or something :0
Southern rough shrimp
No only self learning
Belgian HareOP
cool
@Southern rough shrimp No only self learning
Belgian HareOP
any guides you'd suggest to a newbie?
@Belgian Hare any guides you'd suggest to a newbie?
Southern rough shrimp
Just watch many UIs on google and just make in brain that how u can make it in css
I daily watch many time of UIs
