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

[Headless SSR Proxy] Fix shape of config object #979

Conversation

sc-nikolaoslazaridis
Copy link
Contributor

Description / Motivation

  • Created a new interface LayoutServiceData in sitecore-jss-proxy/ProxyConfig.ts.
  • Changed the shape of ProxyConfig interaface.
  • Implemented the new LayoutServiceData in the sitecore-jss-proxy/index.ts.
  • Typecast to replyWithError arg in sitecore-jss-proxy/index.ts.
  • Removed the 'new' keyword from the cacheMiddleware.js file in the create-sitecore-jss/templates/node-headless-ssr-proxy. It was causing 'Only a void function can be called with the 'new' keyword.' error.
  • Added information to README.md files in create-sitecore-jss/node-headless-ssr-experience-edge and create-sitecore-jss/node-headless-ssr-proxy templates about the use of .env files

Testing Details

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)

…Config.ts and changed the shape of ProxyConfig interaface. Implemented the new LayoutServiceData in the sitecore-jss-proxy/index.ts and added the type Error to replyWithError arg.
…less-ssr-experience-edge and create-sitecore-jss/node-headless-ssr-proxy templates about the use of .env files.
@sc-nikolaoslazaridis sc-nikolaoslazaridis requested a review from a team April 13, 2022 11:16
Copy link
Contributor

@illiakovalenko illiakovalenko 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! See one comment below
@ambrauer Can you also look at the PR, please? You asked to add changes to the README.md, good point

@@ -75,7 +75,7 @@ export interface ProxyConfig {
/** Responses from the proxy greater than this size (in bytes) are rejected. */
maxResponseSizeBytes?: number;
/** The require'd server.bundle.js file from your pre-built JSS app */
serverBundle: {
serverBundle?: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make it required, and fix unit tests

| `DEFAULT_LANGUAGE` | The JSS app's default language. Used to determine language context in case language is not specified in request URL. |
| `PORT` | Optional. Port which will be used when start sample. Default can be seen in [config.js](./config.js). |

These environment variables can be set in the .env file located in the root of the app.
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's put this into the statement above the table (it might get lost down here). Something like:

"The following environment variables can be set to configure the proxy instead of modifying config.js. You can use the .env file located in the root of the app or set these directly in the environment (for example, in containers)."

@@ -45,6 +46,8 @@ The following environment variables can be set to configure the proxy instead of
| `SITECORE_PATH_REWRITE_EXCLUDE_ROUTES` | Optional. Pipe-separated list of absolute paths that should not be rendered through SSR. Defaults can be seen in [config.js](./config.js). |
| `SITECORE_ENABLE_DEBUG` | Optional. Writes verbose request info to stdout for debugging. Defaults to `false`. |

These environment variables can be set in the .env file located in the root of the app.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here (put into statement above the table).

… we provide to test (now it's typed and has serverBundle property). Adjusted the description for environment variables
Copy link
Contributor

@illiakovalenko illiakovalenko left a comment

Choose a reason for hiding this comment

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

Looks great! 👍

@illiakovalenko illiakovalenko merged commit 0a30dac into Sitecore:dev Apr 14, 2022
@sc-nikolaoslazaridis sc-nikolaoslazaridis deleted the bugfix/479510-Fix-shape-of-config-object branch May 9, 2022 16:17
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.

3 participants