diff --git a/.env.production b/.env.production index c34d463..a9c79fb 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,3 @@ -GA_TRACKING_ID=G-355ES1R23J NEXT_PUBLIC_API_URI=https://api.zdamegzaminzawodowy.pl/graphql NEXT_PUBLIC_URL=https://zdamegzaminzawodowy.pl NEXT_PUBLIC_CDN_URI=https://cdn.zdamegzaminzawodowy.pl/ diff --git a/Dockerfile b/Dockerfile index d149754..9a39f02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,28 +8,42 @@ RUN yarn install --frozen-lockfile # Rebuild the source code only when needed FROM node:14.18.1-alpine AS builder + ARG ENABLE_SENTRY_WEBPACK_PLUGIN="false" ARG SENTRY_URL="" ARG SENTRY_ORG="" ARG SENTRY_PROJECT="" ARG SENTRY_AUTH_TOKEN="" +ARG SENTRY_DSN="" + WORKDIR /app + ENV ENABLE_SENTRY_WEBPACK_PLUGIN=$ENABLE_SENTRY_WEBPACK_PLUGIN \ SENTRY_URL=$SENTRY_URL \ SENTRY_ORG=$SENTRY_ORG \ SENTRY_PROJECT=$SENTRY_PROJECT \ SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN \ + SENTRY_DSN=$SENTRY_DSN \ + NEXT_PUBLIC_SENTRY_DSN=$SENTRY_DSN \ BUILDING_PROCESS=true + COPY . . COPY --from=deps /app/node_modules ./node_modules + RUN yarn build # Production image, copy all the files and run next FROM node:14.18.1-alpine AS runner + WORKDIR /app -ENV NODE_ENV=production -ENV BUILDING_PROCESS=false +ARG SENTRY_DSN="" + +ENV NODE_ENV=production \ + SENTRY_DSN=$SENTRY_DSN \ + NEXT_PUBLIC_SENTRY_DSN=$SENTRY_DSN \ + BUILDING_PROCESS=false + COPY --from=builder /app/next.config.js ./ COPY --from=builder /app/public ./public COPY --from=builder /app/.next ./.next diff --git a/src/pages/server-sitemap.xml/index.tsx b/src/pages/server-sitemap.xml/index.tsx index 7a4345a..a07a05a 100644 --- a/src/pages/server-sitemap.xml/index.tsx +++ b/src/pages/server-sitemap.xml/index.tsx @@ -1,6 +1,7 @@ import { GetServerSideProps } from 'next'; import { gql } from 'graphql-request'; import { getServerSideSitemap } from 'next-sitemap'; +import * as Sentry from '@sentry/nextjs'; import { ISitemapField } from 'next-sitemap/dist/@types/interface'; import { createClient } from 'libs/graphql'; import { Query, QueryQualificationsArgs } from 'libs/graphql'; @@ -33,23 +34,22 @@ export const getServerSideProps: GetServerSideProps = async ctx => { if (Array.isArray(items)) { fields = ([] as typeof fields).concat( ...QUESTIONS.map(limit => { - return items.map( - (item): ISitemapField => { - return { - loc: `${WEBSITE_URL}${resolveAs({ - pathname: Route.TestPage, - query: { slug: item.slug, limit }, - })}`, - lastmod: new Date().toISOString(), - changefreq: 'always', - }; - } - ); + return items.map((item): ISitemapField => { + return { + loc: `${WEBSITE_URL}${resolveAs({ + pathname: Route.TestPage, + query: { slug: item.slug, limit }, + })}`, + lastmod: new Date().toISOString(), + changefreq: 'always', + }; + }); }) ); } } catch (e) { console.log('server-sitemap.xml', e.message); + Sentry.captureException(e); } return getServerSideSitemap(ctx, fields);