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

Adjust AIO SSR configuration, handle gzip payload in AIO SSR action #903

Merged
merged 2 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#end
"getRequestTimeout": 10000,
"getAdditionalRequestHeaders": [

]

],
"getCompression": "none"
}
3 changes: 3 additions & 0 deletions src/main/archetype/ui.frontend.react/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ REACT_APP_ROOT=/content/${appId}/${country}/${language}/home.html
AIO_RUNTIME_NAMESPACE=guest
AIO_RUNTIME_AUTH=23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
AIO_RUNTIME_APIHOST=http://localhost:3233
OW_NAMESPACE=guest
OW_AUTH=23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
OW_APIHOST=http://localhost:3233
#end
10 changes: 8 additions & 2 deletions src/main/archetype/ui.frontend.react/actions/ssr/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
require("regenerator-runtime/runtime");
const processor = require('../common/app');
const pako = require('pako');

async function main(args) {

var data;
if (args.__ow_headers['content-type'] === "application/octet-stream") {
data = Buffer.from(pako.inflate(Buffer.from(args.__ow_body, 'base64')), "base64").toString()
} else {
data = args
}

const refinedArgs = {
data: args,
data: data,
pageRoot: args.__ow_headers['page-model-root-url'],
pagePath: args.__ow_path,
wcmmode: args.__ow_headers['wcm-mode']
Expand Down
5 changes: 3 additions & 2 deletions src/main/archetype/ui.frontend.react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@adobe/aio-sdk": "^3.0.0",
"minimist": "^1.2.0",
"node-fetch": "^2.6.0",
"pako": "^2.0.4",
"react-fast-compare": "^3.0.1",
"react-router": "^5.1.2",
"regenerator-runtime": "^0.13.7",
Expand All @@ -44,8 +45,8 @@
"devDependencies": {
#if ( $enableSSR == "y")
"cross-env": "^7.0.3",
"@adobe/aio-cli": "^6.0.0",
"@adobe/wskdebug": "^1.1.3",
"@adobe/aio-cli": "^8.2.0",
"@openwhisk/wskdebug": "^1.3.0",
"babel-core": "^6.26.2",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var isTestEnvironment = process.env.NODE_ENV == 'test';

const serverConfig = {
// Tell webpack to start bundling our app at app/index.js
entry: ['babel-polyfill', './src/server/aem-processor.js'],
entry: ['./src/server/aem-processor.js'],
target: 'node',
externals: nodeExternals({
whitelist: [
Expand Down