mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-08 12:57:46 +00:00
[dev] log middleware errors in vc dev (#8267)
Middleware server setup wasn't logging errors the same way that dev server setup was. This meant that middleware instantiation errors (like invalid config) would cause requests to 500, but no errors to be logged to the console. This PR updates the invalid config error, makes sure errors in this area are logged out, and adds a test for this behavior. **It may be appropriate to fail the deploy (and crash `vc dev`) in this case instead, though. What do others think?** --- During `vc dev` with middleware that has an invalid `config.matcher` value... Before: You see a 500 response in the browser and no output in the terminal. After: You see a 500 response in the browser and this output in the terminal: ``` Error! Middleware's `config.matcher` values must start with "/". Received: not-a-valid-matcher ``` --- Related Issue: https://github.com/vercel/edge-functions/issues/220
This commit is contained in:
@@ -348,7 +348,10 @@ function testFixtureStdio(
|
||||
: []),
|
||||
'deploy',
|
||||
...(process.env.VERCEL_CLI_VERSION
|
||||
? ['--build-env', `VERCEL_CLI_VERSION=${process.env.VERCEL_CLI_VERSION}`]
|
||||
? [
|
||||
'--build-env',
|
||||
`VERCEL_CLI_VERSION=${process.env.VERCEL_CLI_VERSION}`,
|
||||
]
|
||||
: []),
|
||||
'--public',
|
||||
'--debug',
|
||||
@@ -430,7 +433,7 @@ function testFixtureStdio(
|
||||
);
|
||||
}
|
||||
|
||||
if (stderr.includes('Command failed') || stderr.includes('Error!')) {
|
||||
if (stderr.includes('Command failed')) {
|
||||
dev.kill('SIGTERM');
|
||||
throw new Error(`Failed for "${directory}" with stderr "${stderr}".`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user