leerob / site

My site built with Next.js, Tailwind, and Vercel.
https://leerob.com
7.2k stars 1.39k forks source link

Error: msg.startsWith is not a function on Guestbook page #636

Closed christianavi closed 2 months ago

christianavi commented 1 year ago

So like I mentioned on the title, I get this error whenever I open the guestbook/ page: Unhandled Runtime Error Error: msg.startsWith is not a function

Source console.error node_modules\.pnpm\next@13.4.10-canary.6_@opentelemetry+api@1.4.1_react-dom@18.2.0_react@18.2.0\node_modules\next\dist\esm\server\app-render\preload-component.js (5:0)

app\guestbook\page.tsx (48:12) @ error

  46 |   }
  47 | } catch (error) {
> 48 |   console.error(error);
     |          ^
  49 | }
  50 | 
  51 | return (

This is what I see on the console:

  - error TypeError: msg.startsWith is not a function
    at GuestbookPage (./app/guestbook/page.tsx:52:17)
    at async Promise.all (index 0)

I am out of my depth here. I tried to find msg.startsWith on the whole project, but there were no results of it. What could this be?

Nouhack commented 1 year ago

i had the same error , until someone told me : https://github.com/leerob/leerob.io/issues/634#issuecomment-1628298724

z4nr34l commented 1 year ago

I've found a workaround some time ago.

(On latest next version) You need to install next-auth manual commit version "next-auth": "0.0.0-manual.83c4ebd1", and add opentelemetry packages versions override according to package manager you are using to your package.json:

"pnpm": {
    "overrides": {
      "@opentelemetry/api": "1.4.1",
      "@opentelemetry/core": "1.13.0",
      "@opentelemetry/exporter-trace-otlp-grpc": "0.39.1",
      "@opentelemetry/resources": "1.13.0",
      "@opentelemetry/sdk-trace-base": "1.13.0",
      "@opentelemetry/sdk-trace-node": "1.13.0",
      "@opentelemetry/semantic-conventions": "1.13.0"
    }
  },

After that make a clean install of packages and try again, in my projects it worked like a charm.

IF you would still have problems with that, feel free to get in touch (discord: z4nr34l)

z4nr34l commented 1 year ago

This error should not existst now, as I see that page was migrated out from contentlayer, so had I done in my repository, and cant reproduce this issue anymore.

@leerob could you close the issue as it is outdated?

leerob commented 2 months ago

Moved to a different design: https://github.com/leerob/leerob.io/pull/727