Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.0-beta.16]

- Return `413` status code instead of `500` when RPC request body exceeds size limit

## [v1.0.0-beta.15]

- Reduce noisy logs
Expand Down
7 changes: 7 additions & 0 deletions node/immutable_newrelic.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package node
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -63,6 +64,12 @@ func newRelicMiddleware(nrApp *newrelic.Application, next http.Handler) http.Han
mb := int64(1024 * 1024)
body, bodyReader, err := limitedTeeRead(req.Body, mb)
if err != nil {
if errors.Is(err, errBodySizeExceedsLimit) {
log.Warn(err.Error())
http.Error(w, http.StatusText(http.StatusRequestEntityTooLarge), http.StatusRequestEntityTooLarge)
return
}

log.WithError(err).Error("Failed to read request body")
// respond to the client with a 503 error.
// We want to respond here because we can't use the body in subsequent handlers anyway.
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 0 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release
VersionMeta = "beta.15" // Version metadata to append to the version string
VersionMeta = "beta.16" // Version metadata to append to the version string
)

// Version holds the textual version string.
Expand Down