Skip to content

Commit b61e9fe

Browse files
committed
fix: run failed
1 parent 331504d commit b61e9fe

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thecodeorigin/nuxt",
33
"type": "module",
4-
"version": "2.7.3",
4+
"version": "2.7.4",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org",
77
"access": "public"

server/plugins/logger.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import type { H3Event } from 'h3'
33
const EXCLUDED_PATHS = ['/api/health']
44

55
export default defineNitroPlugin(async (nitroApp) => {
6-
// Create a request logger function
7-
const logRequest = logger.createRequestLogger()
6+
const bucket = process.env.AWS_LOGGER_S3_BUCKET
7+
const region = process.env.AWS_LOGGER_S3_REGION
8+
if (bucket && region) {
9+
// Create a request logger function
10+
const logRequest = logger.createRequestLogger()
811

9-
// Hook into each request
10-
nitroApp.hooks.hook('request', async (event: H3Event) => {
11-
if (!EXCLUDED_PATHS.includes(event.path))
12-
await logRequest(event)
13-
})
12+
// Hook into each request
13+
nitroApp.hooks.hook('request', async (event: H3Event) => {
14+
if (!EXCLUDED_PATHS.includes(event.path))
15+
await logRequest(event)
16+
})
17+
}
1418
})

0 commit comments

Comments
 (0)