Skip to content

Commit

Permalink
fix(app-service): fix uncaught promise rejected in cloud function, ca…
Browse files Browse the repository at this point in the history
…use that process exit
  • Loading branch information
maslow committed Nov 3, 2021
1 parent 77b8f0e commit 250a9e6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ services:
ACCOUNT_DEFAULT_APP_QUOTA: 5
APP_SERVICE_DEPLOY_HOST: local-dev.host:8080 # `*.local-dev.host` always resolved to 127.0.0.1, used to local development
APP_SERVICE_DEPLOY_URL_SCHEMA: 'http'
# DEBUG_BIND_HOST_APP_PATH: '${PWD}/packages/app-service'
DEBUG_BIND_HOST_APP_PATH: '${PWD}/packages/app-service'
command: npx nodemon
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
Expand Down
1 change: 1 addition & 0 deletions packages/app-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions packages/app-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,13 @@
"@types/nodemailer": "^6.4.4",
"@types/validator": "^13.1.3",
"typescript": "^4.2.3"
},
"nodemonConfig": {
"ignore": [
"test/*",
"src/*",
"http/*"
],
"delay": 1000
}
}
10 changes: 9 additions & 1 deletion packages/app-service/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-07-30 10:30:29
* @LastEditTime: 2021-11-01 11:37:43
* @LastEditTime: 2021-11-03 16:28:03
* @Description:
*/

Expand All @@ -26,6 +26,14 @@ server.use(express.urlencoded({
extended: true
}) as any)

process.on('unhandledRejection', (reason, promise) => {
logger.error(`Caught unhandledRejection:`, reason, promise)
})

process.on('uncaughtException', err => {
logger.error(`Caught uncaughtException:`, err)
})

/**
* Allow CORS by default
*/
Expand Down

0 comments on commit 250a9e6

Please sign in to comment.