Skip to content
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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/calm-cougars-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-node': minor
Copy link
Member

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

Suggested change
'@sveltejs/adapter-node': minor
'@sveltejs/adapter-node': patch

---

Adapter Node: log getRequest error
Copy link
Member

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

Suggested change
Adapter Node: log getRequest error
fix: log error details when invalid request body is encountered

4 changes: 3 additions & 1 deletion packages/adapter-node/src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ const ssr = async (req, res) => {
bodySizeLimit: body_size_limit
});
} catch (err) {
const request_error_message = 'Invalid request body';
console.error(`${request_error_message}: ${err?.body?.message || 'No message in Error'}`);
res.statusCode = err.status || 400;
res.end('Invalid request body');
res.end(request_error_message);
return;
}

Expand Down
Loading