Skip to content

Commit

Permalink
Fix build and exceptions on azure (#1334)
Browse files Browse the repository at this point in the history
Towards fixing #1285

Fix 
> LanguageWorkerConsoleLog[error] Worker
d515a7ff-9c85-424a-9dbb-7ad7c02d98e8 uncaught exception (learn more:
https://go.microsoft.com/fwlink/?linkid=2097909 ): TypeError:
res._implicitHeader is not a function at writetop
(/home/site/wwwroot/functions/node_modules/express-session/index.js:276:15)
at ServerResponse.end
(/home/site/wwwroot/functions/node_modules/express-session/index.js:343:16)
at Immediate.<anonymous>
(file:///home/site/wwwroot/functions/node_modules/h3/dist/index.mjs:138:17)
at processImmediate (internal/timers.js:464:21)

and fixes (hopefully) that azure builds two app instances by running
`yarn build` and `yarn build:azure`

Followup #1335
  • Loading branch information
tobiasdiez committed Aug 27, 2022
1 parent 0bff227 commit df09e39
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
app_location: '/' # App source code path
api_location: '.output/server' # Api source code path - optional
output_location: '.output/public' # Built app content directory - optional
app_build_command: 'yarn build:azure'
###### End of Repository/Build Configurations ######
env:
DATABASE_URL: ${{ secrets.AZURE_TEST_DATABASE_URL }}
Expand Down Expand Up @@ -122,6 +123,7 @@ jobs:
app_location: '/' # App source code path
api_location: '.output/server' # Api source code path - optional
output_location: '.output/public' # Built app content directory - optional
app_build_command: 'yarn build:azure'
###### End of Repository/Build Configurations ######

- name: Run API tests
Expand Down
16 changes: 16 additions & 0 deletions .yarn/patches/express-session-npm-1.17.3-0819dbe06c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/index.js b/index.js
index 40a442baf2fec2c6bdce79a5fba5086b5b8aac07..321ddabde7361d6ce6b5da450af1be4d6caf3017 100644
--- a/index.js
+++ b/index.js
@@ -273,7 +273,10 @@ function session(options) {
}

if (!res._header) {
- res._implicitHeader()
+ // CHANGED: Workaround for issue with Azure deploy: https://github.com/unjs/nitro/issues/351
+ // Original code taken from https://github.com/nodejs/node/blob/main/lib/_http_server.js
+ res.writeHead(res.statusCode)
+ // res._implicitHeader()
}

if (chunk == null) {
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand",
"test:integration": "cross-env NODE_OPTIONS=--experimental-vm-modules jest test.ts --runInBand",
"test:unit": "cross-env NODE_OPTIONS=--experimental-vm-modules jest spec.ts",
"test:api": "newman run server/postman/TestSuite.json '$@' && newman run server/postman/TestSuiteLoggedIn.json '$@'",
"test:api": "newman run server/postman/TestSuite.json $@ && newman run server/postman/TestSuiteLoggedIn.json $@",
"typecheck": "nuxi typecheck",
"validate": "yarn graphql:validate"
},
Expand Down Expand Up @@ -158,7 +158,8 @@
"ufo": "^0.8.4",
"parse-entities": "^4.0.0",
"unist-builder": "^3.0.0",
"remark-parse": "^10.0.1"
"remark-parse": "^10.0.1",
"express-session@^1.17.3": "patch:express-session@npm%3A1.17.3#./.yarn/patches/express-session-npm-1.17.3-0819dbe06c.patch"
},
"resolutionsComments": {
"@graphql-tools/mock": "Can be removed once apollo-server updated its dependencies: https://github.com/apollographql/apollo-server/issues/5901",
Expand Down
18 changes: 17 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12709,7 +12709,7 @@ __metadata:
languageName: node
linkType: hard

"express-session@npm:^1.17.3":
"express-session@npm:1.17.3":
version: 1.17.3
resolution: "express-session@npm:1.17.3"
dependencies:
Expand All @@ -12725,6 +12725,22 @@ __metadata:
languageName: node
linkType: hard

"express-session@patch:express-session@npm%3A1.17.3#./.yarn/patches/express-session-npm-1.17.3-0819dbe06c.patch::locator=jabref-online%40workspace%3A.":
version: 1.17.3
resolution: "express-session@patch:express-session@npm%3A1.17.3#./.yarn/patches/express-session-npm-1.17.3-0819dbe06c.patch::version=1.17.3&hash=50cc05&locator=jabref-online%40workspace%3A."
dependencies:
cookie: 0.4.2
cookie-signature: 1.0.6
debug: 2.6.9
depd: ~2.0.0
on-headers: ~1.0.2
parseurl: ~1.3.3
safe-buffer: 5.2.1
uid-safe: ~2.1.5
checksum: 90365cd1657a6491b28f829e28e87f636dfd5d527a1420e5c2e573334ddf31e71637f273693b1558a1eae1c50f5ee4b0ea2aedb526e4cd7599e781297f007795
languageName: node
linkType: hard

"express@npm:^4.17.1, express@npm:^4.18.1":
version: 4.18.1
resolution: "express@npm:4.18.1"
Expand Down

0 comments on commit df09e39

Please sign in to comment.