-
Notifications
You must be signed in to change notification settings - Fork 381
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
[POC] Testing utils for SSR Error Handling #19102
Open
pawelfras
wants to merge
57
commits into
develop
Choose a base branch
from
feat/CXSPA-6940
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previous behavior: When `/products` endpoint returned a http error, the code broke in [this line](https://github.com/SAP/spartacus/blob/ed1e1a78c488b1e1214491ffa736612287f8cf70/projects/core/src/product/store/effects/product.effect.ts#L77), complaining that `this` is undefined. Fix: Preserve the context of `this` which was lost in [this line](https://github.com/SAP/spartacus/blob/ed1e1a78c488b1e1214491ffa736612287f8cf70/projects/core/src/product/store/effects/product.effect.ts#L52) The problem was revealed only after we implemented [CXSPA-2251](https://jira.tools.sap/browse/CXSPA-2251) where we referenced `this` by adding `this.logger` to the method `ProductEffects.productLoadEffect` fixes https://jira.tools.sap/browse/CXSPA-3902
Co-authored-by: Krzysztof Platis <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Krzysztof Platis <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
# Conflicts: # projects/core/src/product/store/actions/product-references.action.ts # projects/core/src/product/store/actions/product-reviews.action.ts # projects/core/src/product/store/effects/product-reviews.effect.ts # projects/core/src/state/utils/entity-loader/entity-loader.action.ts
This pull request introduces methodologies for integrating multiple error interceptors that manage errors within the Server-Side Rendering (SSR) framework. This architectural augmentation preserves backward compatibility, mitigating any potential disruptions for end-users upon the incorporation of new error interceptors into the system. With the introduction of this enhancement, it becomes easier for users to include new error interceptors, giving them the flexibility to determine the order in which these interceptors are applied within the system. This priority setting allows users to control how these interceptors operate and influence the workflow of the system. The order is: High priority Normal or no priority Low priority Preserves the original order within a group of interceptors with the same priority.
…I_ERROR_HANDLERS to singular form (#18776)
…t ExpressJS handlers (#18753)
Co-authored-by: Krzysztof Platis <[email protected]>
In the past PR #17657 within this Epic branch, we made a lot of breaking changes. In that past PR we've also renamed public a lot of properties `public payload: any` to `public error: any` which was also a breaking change. In this PR, we: - revert those breaking changes. - bring back `public payload` property, if it was renamed to `public error` - bring back type `any` for `payload`/`error` properties that were changed to `ErrorActionType` - bring back the optional marker (`?`) for `payload`/`error`, that got removed the optional marker (`?`) - bring back the old order of arguments of `EntityScopedFailAction`: `scope, error` vs `error, scope` - additionally, we: - deprecate the signatures with the optional marker on the `payload`/`error` property, in favor of required params - widen type of `payload`/`error` to `any` from too-specific types like `ErrorModel` - pass missing `payload`/`error` parameter to super actions (like `ErrorActionType` etc.) - fix some unit tests as a result of all above changes Note for a reviewer: The PR #19037 (not meant to be merged!) contains a full diff between this branch and the `develop` branch. You may want to check it to verify the current branch `feature/CXSPA-7198--v2` when merged to `epic/ssr-error-handling` will _really_ help to avoid _all_ breaking changes (related to ngrx actions) against `develop` fixes https://jira.tools.sap/browse/CXSPA-7198
…ng errors to the server (#19021)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains utils that help to test different SSR Error Handling scenarios without redeployment/re-building of the app each time we change the app configuration. It has been achieved by adding a service that reacts to the specific query params which control different behaviours:
Config for the fresh and migrated
Prerequisites:
npx ts-node ./tools/schematics/testing.ts
in the SPA root folder`Note: For migrated app, use Angular 17.0.5 because the latest Angular 17 version causes dependencies issue
To use it in a fresh and migrated application, additional adjustments are required:
app.component.ts
, add the following snippet to be able triggering runtime error in a component:app.module.ts
, provide following factories that gives ability to control feature toggles and override endpoints for causing HTTP errors:server.ts
file to manipulate ssr optimization options in runtime:How to use it?
Combine chosen query params in the URL regarding the testing scenario, e.g:
to simulate 404 and enable a custom error page which results in the following page:
Note: Query params have to be set each time page is reloaded.