chec / commercejs-nextjs-vercel

Serverless eCommerce demo store built for the Jamstack. Built with Commerce.js, Next.js and can be one click deployed to Vercel. Includes product catalogue, categories, variants, cart, checkout, order confirmation and printable receipts. This is an open source project.
https://commercejs-nextjs-vercel.vercel.app/
BSD 3-Clause "New" or "Revised" License
84 stars 25 forks source link

Null pointer errors in production build #3

Closed robbieaverill closed 4 years ago

robbieaverill commented 4 years ago

The build is successfully deployed and I have no error in dev env but when I got to the production url I have the following error screen.

An unexpected error has occurred.

And this in console:

framework.0bfd43c6146a5dba8d12.js:1 TypeError: Cannot read property 'trim' of undefined
at d (commons.ccaa6ed8e52a07b02bab.js:1)
at b (commons.ccaa6ed8e52a07b02bab.js:1)
at l.value (084d51adf43dd2d7326ea0fbfb8671e688ad3cdb.9356addacf4eb76817cf.js:1)
at l.value (084d51adf43dd2d7326ea0fbfb8671e688ad3cdb.9356addacf4eb76817cf.js:1)
at ref (084d51adf43dd2d7326ea0fbfb8671e688ad3cdb.9356addacf4eb76817cf.js:1)
at Fu (framework.0bfd43c6146a5dba8d12.js:1)
at t.unstable_runWithPriority (framework.0bfd43c6146a5dba8d12.js:1)
at ql (framework.0bfd43c6146a5dba8d12.js:1)
at Ru (framework.0bfd43c6146a5dba8d12.js:1)
at ku (framework.0bfd43c6146a5dba8d12.js:1)
vo @ framework.0bfd43c6146a5dba8d12.js:1
main-91b36d8235fedba5b259.js:1 TypeError: Cannot read property 'trim' of undefined
at d (commons.ccaa6ed8e52a07b02bab.js:1)
at b (commons.ccaa6ed8e52a07b02bab.js:1)
at l.value (084d51adf43dd2d7326ea0fbfb8671e688ad3cdb.9356addacf4eb76817cf.js:1)
at l.value (084d51adf43dd2d7326ea0fbfb8671e688ad3cdb.9356addacf4eb76817cf.js:1)
at ref (084d51adf43dd2d7326ea0fbfb8671e688ad3cdb.9356addacf4eb76817cf.js:1)
at Fu (framework.0bfd43c6146a5dba8d12.js:1)
at t.unstable_runWithPriority (framework.0bfd43c6146a5dba8d12.js:1)
at ql (framework.0bfd43c6146a5dba8d12.js:1)
at Ru (framework.0bfd43c6146a5dba8d12.js:1)
at ku (framework.0bfd43c6146a5dba8d12.js:1)
(anonymous) @ main-91b36d8235fedba5b259.js:1
08dcbcd9148ab9537593b0245b36b2b2f30850b6.c5fa99948ff0e1873b9b.js:1 Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
at s.value (08dcbcd9148ab9537593b0245b36b2b2f30850b6.c5fa99948ff0e1873b9b.js:1)
Failed to load resource: the server responded with a status of 404 ()
eufandem commented 4 years ago

This bug is also present in the https://github.com/chec/commercejs-nextjs-demo-store/issues repo. Please apply changes to the Netlify version as well

robbieaverill commented 4 years ago

Just tested a one click deploy on Vercel. My build succeeded and the site operates correctly.

robbieaverill commented 4 years ago

I can't reproduce the original build error, but I've fixed the Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null errors in both demo store repos (https://github.com/chec/commercejs-nextjs-vercel/pull/4 and https://github.com/chec/commercejs-nextjs-demo-store/pull/97).

The first two "TypeError: Cannot read property 'trim' of undefined" errors are likely side-effects from React as a result of the previous error.