Faster Next.JS docker builds with npm cache

If you have a Dockerfile which looks something like (note: likely not complete, this is a very stripped down version of our Dockerfile): FROM node:16.19.0 as prodbuild COPY ./package*.json ./ RUN npm ci –omit=dev FROM node:16.19.0 as build COPY ./package*.json ./ # We need dev dependencies to actually do the build RUN npm ci RUN npm run web:build FROM node:16.19.0 COPY –from=prodbuild /usr/src/node_modules ./node_modules COPY –from=build /usr/src/.next .next ENTRYPOINT ["npm", "run", "start"] There are a few inefficiencies.
Read more →

Sentry reports browser runtime for errors in getServerSideProps in a Next development build

In Development mode for next.js (npm run dev), errors within getServerSideProps, which are supposed to occur solely in the node.js runtime, are inaccurately reported by Sentry as originating from the Browser. This means that any changes made to the server-side scope are not reflected in the trace. This anomaly might stem from a Next.js feature that catches and displays server-side errors and stack-traces in the browser to assist development. It seems Next.
Read more →