-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 9475 adapter node log request error #9702
fix: 9475 adapter node log request error #9702
Conversation
🦋 Changeset detectedLatest commit: dab875d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I haven't had time to dig into this, just wanted to point out that you should add a test to assert that the warning is being logged. Here's how: kit/packages/kit/test/apps/basics/test/test.js Lines 830 to 844 in b48d58e
|
@@ -0,0 +1,5 @@ | |||
--- | |||
'@sveltejs/adapter-node': minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change could be considered a feature or a fix. I'm not sure it's big enough for a new minor release, so a patch release is probably more appropriate
'@sveltejs/adapter-node': minor | |
'@sveltejs/adapter-node': patch |
'@sveltejs/adapter-node': minor | ||
--- | ||
|
||
Adapter Node: log getRequest error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we prefix messages with fix:
or feat:
. the whole changelog is for adapter-node, so noting that again wouldn't add anything
Adapter Node: log getRequest error | |
fix: log error details when invalid request body is encountered |
My question with this is whether it would get annoying and fill the logs. I'm not that familiar with how logging is configured in JavaScript. This category of issue doesn't indicate any issue with the application and so I'm not sure that |
I've had a lot of trouble debugging an app running with the node adapter. There's literally nothing logged aside from the initial "listening" message. I think we need to go even further than this PR, but this is at least a good start to handle one kind of error condition. I've been googling for quite a while to better understand how to troubleshoot adapter-node apps and have come up empty-handed, and also tried asking on the Discord. When you have a production application deployed with adapter-node, at some point you're going to want some logging for later troubleshooting. If you want to keep the noise down, we could use a log level or env var. I'm not quite sure what the typical JS idioms are here either, but I don't think complete silence is reasonable. |
This (and #9475) can now be closed — since #11289 (i.e. SvelteKit 2), creating the request will always succeed, and if there's an invalid body we'll find out when we try and read it: export async function POST({ request }) {
// if the request body is invalid, this will fail, and `handleError` will be invoked
const body = await request.json();
// ...
} There is a small issue in that |
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Fixes #9475
![image](https://user-images.githubusercontent.com/30938967/232783597-62e5ff20-901d-4b3a-b4fe-eefa72e798ea.png)
This change will additionally log an error if the getRequest function in the SSR handler fails.
I don't think we should test for an error log 😉
Will log an error similar to: