#Unexpected token : export , in next-auth. Site crashes

58 messages Β· Page 1 of 1 (latest)

void cairn
#

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 😦

tidal surgeBOT
#

πŸ”Ž This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      πŸ•΅οΈ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      βœ… You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
void cairn
#

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?

#

@harsh falcon sorry to ping you man! but do you know anything about this? our production site's on stake 😦

harsh falcon
#

@void cairn 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?

void cairn
harsh falcon
#

Yeah never-mind, just mis-read that πŸ˜‚

#

Gimme a sec

void cairn
#

next auth doc says to configure NEXTAUTH_URL but thats already configured at my end!

harsh falcon
#

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)...

void cairn
harsh falcon
#

Can I see your tsconfig.json file, and your package.json?

#

And also your next.config.js file please.

harsh falcon
#

Just paste it here using a code-block.

void cairn
#

discord limited it

harsh falcon
#

Easier for me that way.

#

Send it in 2 parts shrug

void cairn
#
{
  "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

harsh falcon
#

Or use github gists

void cairn
#
module.exports = {
  images: {
    domains: [''],
  },
  compiler: {
    styledComponents: true,
  },
  reactStrictMode: false,
};

next.config.js

void cairn
harsh falcon
#

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?

void cairn
#

gives me lots of errors

harsh falcon
# void cairn

So do what it says, and convert/rename postcss.config.js into postcss.config.cjs

harsh falcon
#

Well I mean now you have more errors to work with πŸ˜‚

void cairn
#

I didnt had to do all of these before tho!

#

it worked fine without the type module

harsh falcon
#

Well, something is probably causing an issue...

#

But if you want to ignore it and go back, sure.

#

@void cairn Try doing pnpm update (or whatever you use)

void cairn
#

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.

void cairn
#

@harsh falcon this fixed it man

#

#next-auth message

#

so it was an upstream issue after all, just removed the caret ^ from version number in package.json

tidal surgeBOT
#
βœ… Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1130931384471519232 message)

flat geyser
#

Oh nvm u fixed it

void cairn
harsh falcon
flat geyser
void cairn
#

your UI design looks very beautiful too!

#

did you take any course or something :0

flat geyser
void cairn
#

cool

void cairn
flat geyser
#

I daily watch many time of UIs