File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ import sharp from 'sharp'
66import type { ExtendedRequest } from '@/types'
77import { assetCacheControl , defaultCacheControl } from '@/frame/middleware/cache-control'
88import { setFastlySurrogateKey , SURROGATE_ENUMS } from '@/frame/middleware/set-fastly-surrogate-key'
9+ import { createLogger } from '@/observability/logger'
10+
11+ const logger = createLogger ( import . meta. url )
912
1013/**
1114 * This is the indicator that is a virtual part of the URL.
@@ -83,6 +86,7 @@ export default async function dynamicAssets(
8386 if ( req . path . endsWith ( '.webp' ) ) {
8487 const { url, maxWidth, error } = deconstructImageURL ( req . path )
8588 if ( error ) {
89+ logger . warn ( 'Invalid dynamic asset URL' , { path : req . path , error } )
8690 return res . status ( 400 ) . type ( 'text/plain' ) . send ( error . toString ( ) )
8791 }
8892 try {
@@ -149,6 +153,7 @@ export default async function dynamicAssets(
149153 'code' in catchError &&
150154 ( catchError as NodeJS . ErrnoException ) . code !== 'ENOENT'
151155 ) {
156+ logger . error ( 'Failed to process dynamic asset' , { path : req . path , error : catchError } )
152157 throw catchError
153158 }
154159 }
You can’t perform that action at this time.
0 commit comments