Conversation
…s if `AI_GATEWAY_API_KEY` is not configured
| 'Learn more: \u001b[34mhttps://vercel.link/unauthenticated-ai-gateway-v6\u001b[0m\n', | ||
| ); | ||
|
|
||
| process.exit(1); |
There was a problem hiding this comment.
I wonder if we would throw prettyErrorMessage instead of using process.exit() (where prettyErrorMessage is the full string with colors that currently gets logged out). We would still get a pretty message, but in a dev server environment it wouldn't kill the process
lgrammel
left a comment
There was a problem hiding this comment.
I think it is important to keep the stack traces. Maybe it can be pruned? a nicer message is great
|
For pruning I really like https://github.com/sindresorhus/clean-stack but we won't bring in new dependencies just for that, even if Sindre's modules are small and high quality. I'd just limit the number of stack lines to 5 |
| if (!GatewayAuthenticationError.isInstance(error)) return error; | ||
|
|
||
| const isProductionEnv = process?.env.NODE_ENV === 'production'; | ||
| const moreInfoURL = 'https://vercel.link/unauthenticated-ai-gateway-v6'; |
There was a problem hiding this comment.
we are adding redirects to ai-sdk.dev right now
There was a problem hiding this comment.
wait until these work:
| // prune the stack to 5 lines for clarity | ||
| if (devEnvironmentError.stack) { | ||
| devEnvironmentError.stack = devEnvironmentError.stack | ||
| .split('\n') | ||
| .slice(0, 6) | ||
| .join('\n'); | ||
| } |
There was a problem hiding this comment.
hm how would this look like in practice? we do not know how deep the user side stack trace is.
| if (!GatewayAuthenticationError.isInstance(error)) return error; | ||
|
|
||
| const isProductionEnv = process?.env.NODE_ENV === 'production'; | ||
| const moreInfoURL = 'http://v6.ai-sdk.dev/unauthenticated-ai-gateway'; |
| if (!GatewayAuthenticationError.isInstance(error)) return error; | ||
|
|
||
| const isProductionEnv = process?.env.NODE_ENV === 'production'; | ||
| const moreInfoURL = 'https://v6.ai-sdk.dev/unauthenticated-ai-gateway'; |
There was a problem hiding this comment.
will change to 'https://ai-sdk.dev/unauthenticated-ai-gateway' in backport to v5
|
|


Summary
this PR changes
to
Manual Verification
Tested locally
Checklist
fixes / features)
features)
fixes / features - run
pnpm changesetin the project root)Future Work
environments