Next.js Discord

Discord Forum

SyntaxError: Unexpected token '?'

Unanswered
American Bobtail posted this in #help-forum
Open in Discord
Avatar
American BobtailOP
I'm using Sentry to track runtime errors in NextJS and I see a lot of errors like

Unexpected token '?'

  return (
    <Container component="section" sx={{ display: 'flex', justifyContent: 'center' }}>
      <Breadcrumbs
        aria-label="breadcrumb"
        sx={{
          mt: props.mt ?? 4, // <--- here
          '& > ol': {
            justifyContent: 'center',
          },
        }}
      >


Unexpected token '.'

value.push({
  id: nanoid(),
  origin: firstSegment?.destination, // <--- here
  destination: firstSegment?.origin,
  departureDate: closestDeparture,
});


Thought I'm entirely not sure why they occur. Sentry says that it happens on fresh versions of Chrome Mobile (128.0, 129.0) which seems to support both nullish coalescing operators and optional chaining. Also IIRC NextJS includes a polyfill into bundle otherwise. How can I debug this and where to look?

0 Replies