Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a friendly message when building nextjs app and site items are missing #1066

Conversation

art-alexeyenko
Copy link
Contributor

npm run build will no longer fail when building an app for a site that doesn't have items on the Sitecore side - a friendly message with some explanation will be shown.

Description / Motivation

Small changes to graphql-sitemap-service and to the catch-all page in nextjs template.

Testing Details

Extra unit tests added for graphql-sitemap-service to ensure the error is thrown.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@art-alexeyenko art-alexeyenko requested review from a team, ambrauer and illiakovalenko and removed request for a team June 20, 2022 23:31
Copy link
Contributor

@ambrauer ambrauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Even more resilience for getStaticPaths than originally intended 👍

@ambrauer ambrauer merged commit ea649b1 into Sitecore:dev Jun 21, 2022
ambrauer added a commit that referenced this pull request Jul 11, 2022
…ssing (#1066)

* Friendly message for when no results are returned and error handling on the nextjs app side

* PR comments

* Marking the function for empty site error as private

(cherry picked from commit ea649b1)

# Conflicts:
#	packages/sitecore-jss-nextjs/src/services/graphql-sitemap-service.test.ts
#	packages/sitecore-jss-nextjs/src/services/graphql-sitemap-service.ts
illiakovalenko added a commit that referenced this pull request Sep 21, 2022
* v20.1.0-canary.0

* fixed undefined placehodler issue (#970)

(cherry picked from commit 4ecff7e)

* [sitecore-jss-react] Make Image handle 'class' prop when it's passed down (#971)

* #525669: make Image handle 'class' prop when it's passed down

* lint fixes added to files

(cherry picked from commit 2963a98)

* [Nextjs] New NextImage component (#978)

* Implement Nextjs Image nextjs package and styleguide

* WIP: Implement nextjs image in nextjs package and styleguide

* Refactored image loader

* Refactor way in which EE markup is applied
in react image component to be reused in next image component.

* WIP: Start refactoring test for nextjs image
also refactor nextjs-styleguide template to use new image component

* added tests and completed todos

* removed unwanted code and added line to end of file

* addressed review comments

* fixed unit tests

* removed dublicate code

* removed extra comments

* updated yarn.lock

* updated yarn.lock, removed dubplicate interface

* removed changes in yarn.lock

* updated yarn.lock

* updated yarn.lock

* fixed linting error

* updated deviceSizes comment in next.config

* improved comments, added utility to get hostname

* removed path and loader from config

* added relative path to loader function

* added comment for path variable

* updated error message, removed extra interface

* fixed undefined path variable issue

* added test cases for the loader function

* renamed next-setup file

* updated next.config comments, refactored redundant code

* added the fix from vercel regarding access to config in loader function

* removed blurDataUrl, made loader function more customizable, fixed tests

* Delete yarn.lock

* added yarn.lock

* updated yarn.lock

* changed next version in template

* removed redundant comments and files , changed error message

* added test case for user custom loader function

* added another test case fro custom loader

* added test for absolute url, mock loader function

* added test for user sent custom loader

* removed params object, added afterEach

* updated the afterEach call

* refactored mock loader tests

* created two describes for next image tests

* updated tests description

* updated the order of tests and describes in next image tests

* Simplified loader which does not depend on 'config' (not to be used according to Vercel: vercel/next.js#35115). Added whitelisting config for default next/image sizes.

* updated image url, fixed classname bug for EE in next/image

* added unit test

* remove console.log

* resolved merge conflicts in yarn.lock file

* refactored util fucntions, removed redundant code

* updated yarn.lock, refactored utils

* removed url-parse

Co-authored-by: CobyPear <coby.sher@sitecore.com>
Co-authored-by: Adam Brauer <400763+ambrauer@users.noreply.github.com>
(cherry picked from commit 2c759c1)

* [Vue] Fix Sitecore querystring property in Link component (#974)

* fixed link querystring issue

* added test for querystring attribute

* removed comments

(cherry picked from commit 5cd1286)

* [node-headless-ssr-exp-edge][Angular] Danish language is not rendered when refresh the page (#1003)

(cherry picked from commit d917dc0)

* [Next.js] Update `jss create` related info on the home page (#1009)

(cherry picked from commit 3d36f45)

* [Nextjs][SDK] RichText component not forwarding query params (#1015)

* fixed issue for sending queryparms with pathname

* remove console.log

(cherry picked from commit 70f0628)

* [Headless SXA] Nextjs-SXA empty add-on (#927)

* add nextjs-sxa empty add-on

* removed package.json, added placeholder component

* changed placeholder component description

(cherry picked from commit cf11cfd)

# Conflicts:
#	packages/create-sitecore-jss/src/initializers/nextjs/index.ts

* [Headless SXA][NextJS] Support SXA Rendering Variants inside the Placeholder component (#931)

* [Headless SXA][NextJS] Support SXA Rendering Variants inside the Placeholder component

* Add empty line

* Remove space

* Fix eslint errors

* Extract function

* Eslint

(cherry picked from commit 8d4f20e)

* [Initializers] Add descriptions to add-on list (#935)

* [Initializers] Add descriptions to add-on list

* Update

* Change word

(cherry picked from commit 9fdf43b)

* [Nextjs] Create plugins approach for the nextjs middleware (#945)

* [Nextjs] Create plugins approach for the nextjs middleware

* add NextFetchEvent

(cherry picked from commit 8d452e7)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs-personalize/src/lib/middleware/plugins/personalize.ts

* #487176 added robots.txt implementation (#946)

* #487176 added robots.txt implementation

Added robots.txt implementation, services for sitercore-jss/sitecore-jss-nextjs, sample for create-sitecore-jss

* #487176: refactoring and fixed comments

* #487176: added site.js and site.d.ts

* #487176 added robots.txt implementation

Added robots.txt implementation, services for sitercore-jss/sitecore-jss-nextjs, sample for create-sitecore-jss

* #487176: refactoring and fixed comments

* #487176 added robots.txt implementation

Added robots.txt implementation, services for sitercore-jss/sitecore-jss-nextjs, sample for create-sitecore-jss

* #487176: refactoring and fixed comments

* #487176 added robots.txt implementation

Added robots.txt implementation, services for sitercore-jss/sitecore-jss-nextjs, sample for create-sitecore-jss

* #487176: refactoring and fixed comments

* #487176: removed unused vars in unit test

* #487176: added site.d.ts into exclude

* #487176: fixed lint errors

* #487176 added extend rewrites for next.config

* #487176 added a new line

(cherry picked from commit 43f7754)

* Feature/520166 (#957)

* #520166 Initial move of existing code

* #520166: added lost components for fix this sample

* #520166: reverted missed file Layout.tsx

* #520166 added Navigation component in the Layout

* #520166 removed .next from .gitignore

* #520166 refactoring for moving SXA nextjs

* #520166 moved robots.ts from components to pages folder

* #520166: refactoring and fixed comments

* #520166 fixed unit test

* #520166 added test and comments for code

* #520166 fixed comments

* #520166 fixed comments (repair after wrong rebase)

Co-authored-by: Dawid Rutkowski <daru@sitecore.net>
Co-authored-by: Ruslan Matkovskyi <matkovsky.ruslan@gmail.com>
(cherry picked from commit 540a2f5)

* Feature/519338 redirect nextjs (#969)

* #519338: implement redirect service and middleware

* #519338 refactoring redirects service. added unit tests

* #519338 moved redirects service into sitecore-jss

* #519338 fixed graphql-request for nextJs middleware and tests

* #519338 modified yarn.lock

* #519338 fixed test for sitecore-jss-nextjs

* #519338 refactoring: moved constants

* #519338 refactoring and fixed comments

* #519338 update yarn.lock

* #519338 fixed lint

* #519338 fixed comments and added unit-test

* #519338 added unit test for middleware redirects

* #519338 fixed lint error and yarn.lock

* #519338 fixed yarn.lock

* #519338 removed unit-test of redirects middleware and fixed yarn.lock

* #519338 added isomorphic-fetch for run pipline

* #519338 removed unused package

* #519338 removed test(override fetch)

(cherry picked from commit b963d40)

* #520166 added bootstrap css and Layout component for SXA side (#972)

* #520166 added bootstrap css and Layout component for SXA side

* #520166 update yarn.lock

* #520166 removed wrong css

(cherry picked from commit 4d03320)

* #520166: fix issues caused by refactoring (#973)

(cherry picked from commit f418eb9)

* #hotfix added boostrap into package.json for nextjs-sxa (#981)

(cherry picked from commit 17423c6)

* #hotfix fixed import middleware nextjs-sxa (#984)

(cherry picked from commit ba8b08f)

* Hotfix/redirects middleware (#985)

* #hotfix fixed wrong build redirects middleware

* #hotfix update yarn.lock

(cherry picked from commit ae74f74)

* Feature/487176 implementation sitemap (#991)

* #487176 added sitemap middleware

* #487176 implemented sitemap middleware

* #487176 refactoring sitemap service

* #487176 refactoring and added unit test for sitemap service

* #487176 refactoring

* #487176 removed deprecated package(request)

(cherry picked from commit 723a382)

* Feature/487176 implementation sitemap (#998)

* #487176 added sitemap middleware

* #487176 implemented sitemap middleware

* #487176 refactoring sitemap service

* #487176 refactoring and added unit test for sitemap service

* #487176 refactoring

* #487176 removed deprecated package(request)

* #487176 renamed sitemap service

(cherry picked from commit f688110)

* #526106: Extend SXA Headless layout with 3 placeholders instead of one (#1001)

(cherry picked from commit 0e57cc1)

* #526107 | Define example Rendering Variants for existing Headless components

(cherry picked from commit bb48991)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs-sxa/src/components/Title.tsx

* #530659: [SXA][Headless] In preview mode links are broken because ? remains encoded (#1014)

(cherry picked from commit 52fb471)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs-sxa/src/components/Title.tsx

* #530304 [Nextjs][SXA] decode url for redirects (#1017)

(cherry picked from commit 4d9b264)

* #530555: [SXA][Headless] Redirects with defined language in source URL don't work (#1023)

* #530555: [SXA][Headless] Redirects with defined language in source URL don't work

* #530555: Avoid importing NextURL

* #530555: Move locales property inside RedirectsMiddleware instead of RedirectsPlugin

* #530555: Move locales property inside RedirectsMiddlewareConfig

(cherry picked from commit 2d7899a)

* [Next.js] Middleware updates (#1008)

(cherry picked from commit cd0d3a6)

* [Nextjs] Dynamic components markup is missing in Experience Editor after adding new rendering (#1019)

* Adding an extra componentFactory method to work in editing mode

* addressing comments, prettifying code

* Update packages/create-sitecore-jss/src/templates/nextjs/scripts/templates/component-factory.ts

Co-authored-by: Illia Kovalenko <23364749+illiakovalenko@users.noreply.github.com>
(cherry picked from commit ba8cd0d)

* #534065 | Grid columns are not shown in Experience Editor (#1038)

(cherry picked from commit ab02c17)

* Fixing optional params in component factory template (#1040)

(cherry picked from commit dbad78f)

* [NextJs] Fix "debug module not found" error in redirects middleware (#1045)

* Remove import of next.config.js in redirects middleware (fixes #535263) and use static values for now. next.config.js is not intended to be imported in this way. We should have access to locales directly in middleware in the future: vercel/next.js#37253

* Add type assist jsdoc for NextConfig

(cherry picked from commit 2e28076)

* [nextjs-sxa] hotfix eslint for building nextjs-sxa (#1046)

* hotfix eslint for building nextjs-sxa

* hotfix eslint for building nextjs-sxa

* #hotfix fixed lint errors

(cherry picked from commit 962bf7a)

* #533938 added styles sass (#1058)

* #533938 added styles sass

* #533938 removed local fontawesome and added npm package fontawesome

(cherry picked from commit 82d287e)

* #535917 added styles for sxa initializer(basic site) (#1062)

* #535917 fixed lint errors(added end of line)

* #535917 fixed comments

* #535917: fixed comments

(cherry picked from commit ba9dde0)

* [SXA] hotfix: change name of property (#1063)

(cherry picked from commit e46bdb3)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs-sxa/src/Layout.tsx

* #hotfix: fixed return data of redirects (#1064)

(cherry picked from commit f96271f)

* [SXA] #539173 removed JSS links hardcode. fixed styles,  (#1068)

* #539173 removed JSS links hardcode. fixed styles, added behavior mobile menu

* #539173 fixed comments

(cherry picked from commit 25fb377)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs-sxa/src/Layout.tsx

* [SXA] #539173 fixed lint (#1069)

(cherry picked from commit 7e6f04d)

* [SXA] #539379 check and fix comments from Rob (#1070)

(cherry picked from commit 618161c)

* [SXA] Bugfix/539379 fix sxa initializer styles (#1072)

* #539379: fixed style for new structure of basic site

* #539379 changed styles and rebase

(cherry picked from commit e0112fb)

* [Next.js][Middleware] start:production 'Dynamic Code Evaluation' error (#1073)

(cherry picked from commit 079424a)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs/package.json
#	packages/sitecore-jss/package.json
#	yarn.lock

* [SXA] Bugfix/539379 fix sxa initializer styles (#1075)

* #539379: fixed style for new structure of basic site

* #539379 changed styles and rebase

* #539379 fixed loading fonts for production version

* #539379 [SXA] fixed mobile menu

* #539379 fixed comments

(cherry picked from commit 57e200e)

* [SXA][XMCloud] Navigation rendering doesn't have default rendering variant (#1076)

(cherry picked from commit 6d873a2)

* [SXA] #539752 The site can't be opened in the EE and Pages in case the rendering host was connected to the site that was not published (#1081)

* #539752 The site can't be opened in the EE and Pages in case the rendering host was connected to the site that was not published

* Update

* UpdatE

(cherry picked from commit 37d444e)

* #540549 | [SXA][Headless] Missing classes for navigation component (#1082)

(cherry picked from commit 1d3e3b1)

* [SXA] Bugfix/539379 fix sxa initializer styles (#1083)

* #539379: fixed style for new structure of basic site

* #539379 changed styles and rebase

* #539379 fixed loading fonts for production version

* #539379 [SXA] fixed mobile menu

* #539379 fixed comments

* #539379 [SXA] fixed styles for EE

(cherry picked from commit 5dc5cc3)

* [sitecore-jss-react] Refactored `withComponentFactory` HOC (#1086)

* refactored withComponentFactory enhancer

* removed consumer

(cherry picked from commit fa5e259)

* [sitecore-jss] Make it clear that isEditorActive only works in browser (#1089)

(cherry picked from commit 0c848b7)

* #541171 [SXA] fixed styles for SXA initializer site (#1092)

(cherry picked from commit f661996)

* #541171 [SXA] fixed styles (#1094)

(cherry picked from commit 518c3c7)

* [Nextjs] Update nextjs to 12.2 (#1093)

* Nextjs version update plus extra upgrade steps for middleware

* Moved middleware.ts to recommended location (adjacent to pages)

* Updated next-env.d.ts

* Comment updates (use generic "Sitecore editor", next/image now supported, next doc links changed)

* Removed .babelrc (as of 12.2, swc appears to work in Windows-based rendering hosts in containers - or at least acts no differently than with it)

* Add the _next... URL exclusion rule for personalize middleware

Co-authored-by: Adam Brauer <400763+ambrauer@users.noreply.github.com>
(cherry picked from commit 5fc2e3d)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs/package.json
#	packages/sitecore-jss-nextjs/package.json
#	packages/sitecore-jss-nextjs/src/edge/personalize-middleware.ts
#	yarn.lock

* regenerate lock file

* add  --no-immutable option to yarn install for lerna version CI step (was seeing "The lockfile would have been modified by this install, which is explicitly forbidden.")

* version v20.1.0-canary.1 [skip ci]

* Add a friendly message when building nextjs app and site items are missing (#1066)

* Friendly message for when no results are returned and error handling on the nextjs app side

* PR comments

* Marking the function for empty site error as private

(cherry picked from commit ea649b1)

# Conflicts:
#	packages/sitecore-jss-nextjs/src/services/graphql-sitemap-service.test.ts
#	packages/sitecore-jss-nextjs/src/services/graphql-sitemap-service.ts

* version v20.1.0-canary.2 [skip ci]

* [Nextjs][Personalize] Productize layout response transform (#962)

(cherry picked from commit f43645f)

* version v20.1.0-canary.3 [skip ci]

* Updated CHANGELOG

* version v20.1.0-canary.4 [skip ci]

* #533938 fixed styles for managed classes (#1097)

(cherry picked from commit 1368878)

* version v20.1.0-canary.5 [skip ci]

* #533938: added fullwidth style for basic site

* version v20.1.0-canary.6 [skip ci]

* [Nexjs] withSitecoreContext HOC doesn't provide context value (#1100)

* [Nexjs] withSitecoreContext HOC doesn't provide context value

* Updated CHANGELOG

Co-authored-by: Adam Brauer <400763+ambrauer@users.noreply.github.com>

* version v20.1.0-canary.7 [skip ci]

* #542773: [SXA] fixed EE placeholders

(cherry picked from commit 6ed635d)

* version v20.1.0-canary.8 [skip ci]

* #hotfix: [SXA] fixed background-image

(cherry picked from commit fb7a4ff)

* version v20.1.0-canary.9 [skip ci]

* [Nextjs] Remove `edge` next config plugin (#1105)

* [Nextjs] Remove `edge` next config

* Update changelog

* Update CHANGELOG.md

Co-authored-by: Adam Brauer <400763+ambrauer@users.noreply.github.com>

* version v20.1.0-canary.10 [skip ci]

* #541175 [SXA] fixed style of placeholders

(cherry picked from commit 76550e8)

* version v20.1.0-canary.11 [skip ci]

* added priority to responsive image sample

(cherry picked from commit f2a7b81)

# Conflicts:
#	packages/create-sitecore-jss/src/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Image.tsx

* version v20.1.0-canary.12 [skip ci]

* #539620: [SXA] fixed navigation link in editing mode

(cherry picked from commit 0260b6b)

* version v20.1.0-canary.13 [skip ci]

* Up canary version

* version v20.1.0-canary.14 [skip ci]

* Quick fix for `sitecore-jss-nextjs` version

* version v20.1.0-canary.15 [skip ci]

* #542500: fixed component container and style Error block (#1121)

(cherry picked from commit 9b8060e)

* version v20.1.0-canary.16 [skip ci]

* #546451: added fix when receive from backend haven't FiledsName (#1122)

(cherry picked from commit 0ebb562)

* version v20.1.0-canary.17 [skip ci]

* nextjs upgrade with updated yarn and babel reintroduction

* version v20.1.0-canary.18 [skip ci]

* fix timeout error in EE

(cherry picked from commit 54afc0b)

* version v20.1.0-canary.19 [skip ci]

* #507309: merged error handler

* version v20.1.0-canary.20 [skip ci]

* #532377: [Implementation] Add missing Headless column splitter component (#1137)

(cherry picked from commit a26fbb0)

* #516591: Add missing Headless row splitter component (#1146)

(cherry picked from commit e9d6650)

* version v20.1.0-canary.21 [skip ci]

* #545161: [SXA] fixed styles for Basic Site

(cherry picked from commit f5778bc)

* #merge-535452: remove id wrapper

* #remove-style-from-banner: merge

* #remove-style-from-banner: removed banner-background style

(cherry picked from commit 8b8a596)

* version v20.1.0-canary.22 [skip ci]

* #hotifx: removed unused vars

* version v20.1.0-canary.23 [skip ci]

* [NextJs] Specify AppProps generic type in _app.tsx to align with latest changes from Next 12.3.0 (#1155)

* [NextJs] Specify AppProps generic type in _app.tsx to align with latest changes from Next 12.3.0

* Update CHANGELOG

* Use SitecorePageProps

* revert

* version v20.1.0-canary.24 [skip ci]

* #552444: fixed a top menu of basic site (#1162)

(cherry picked from commit bdd8407)

* version v20.1.0-canary.25 [skip ci]

Co-authored-by: Adam Brauer <400763+ambrauer@users.noreply.github.com>
Co-authored-by: Addy Pathania <89087450+sc-addypathania@users.noreply.github.com>
Co-authored-by: Artem Alexeyenko <ala@sitecore.net>
Co-authored-by: Ruslan Matkovskyi <100142572+matkovskyi@users.noreply.github.com>
Co-authored-by: Anton Kechashin <atk@sitecore.net>
Co-authored-by: Alan Płócieniak <alan-null@outlook.com>
Co-authored-by: Dawid Rutkowski <33089653+sc-dawidrutkowski@users.noreply.github.com>
Co-authored-by: Automated Build <builds@sitecore.com>
Co-authored-by: Ruslan Matkovskyi <rusm@sitecore.net>
Co-authored-by: Addy Pathania <aditya.pathania@sitecore.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants