React app caching & bundle issues

Your issue
We’re getting errors in production that say that our react bundles couldn’t be found

The javascript console spits out the above error, which disappears when we refresh the page. We only see these issues loading pages after deploys (doesn’t happen incognito). My best guess is that there’s some caching issue with our webpack bundles that’s causing the app to search for an old file / not find an existing one.

Dockerfile content (if any)

FROM node:16-alpine3.11 as build

WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH

ARG REACT_APP_API_URL
ENV REACT_APP_API_URL=$REACT_APP_API_URL

COPY package.json ./
COPY yarn.lock ./

RUN yarn
COPY . ./
RUN yarn build

# production environment
FROM nginx:stable-alpine as production
RUN rm /etc/nginx/conf.d/default.conf
COPY conf.d/default.conf /etc/nginx/conf.d
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Hey @nimo, thanks for your patience.

Can you give me a way to reproduce your issue?

@rophilogene – I’m not sure what the best way to reproduce this is. It happens on deploys, perhaps I can setup a simple create react app with some lazy loaded bundles, and we can try deploying, updating & deploying again? The issue seems to be happening at the second deploy.

If you can do that it would be great. Then we can make sure it will be fixed for ever :slight_smile: thank you @nimo