Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 100d949 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 |
dani7514
had a problem deploying
to
external-testing
November 27, 2026 21:11 — with
GitHub Actions
Error
Comment on lines
+157
to
+172
| const pagesApp = () => | ||
| http.createServer((req, res) => { | ||
| Object.assign(res, {revalidate: async () => {}}) | ||
| const writeHead = res.writeHead.bind(res) | ||
| res.writeHead = ( | ||
| status, | ||
| reason?, | ||
| headers?: http.OutgoingHttpHeaders | http.OutgoingHttpHeader[] | ||
| ) => { | ||
| if (typeof reason !== 'string') return writeHead(status, reason) | ||
| // The compression bundled with Next.js Pages cannot read flat arrays. | ||
| return writeHead(status, reason, Array.isArray(headers) ? undefined : headers) | ||
| } | ||
| res.setHeader('X-App', 'pages') | ||
| void server.handle(req, res) | ||
| }) |
There was a problem hiding this comment.
Comment on lines
+185
to
+195
| it('preserves an early stream error through Pages middleware', async () => { | ||
| server.get('/failed-stream', () => { | ||
| const body = new Readable({ | ||
| read() { | ||
| this.destroy(new Error('read failed')) | ||
| }, | ||
| }) | ||
| return new FastResponse(body, {headers: {'X-Success': 'true'}}) | ||
| }) | ||
| const response = await request(pagesApp()).get('/failed-stream').expect(500) | ||
| assert.equal(response.headers['x-success'], undefined) |
There was a problem hiding this comment.
🔍 Built-in downloads lack early error coverage
The FastResponse test defers headers until the Node stream is readable. GetHandler.send returns a native Response, so srvx sends success headers before reading the file stream.
Was this helpful? React with 👍 or 👎 to provide feedback.
dani7514
requested a deployment
to
external-testing
November 28, 2026 15:56 — with
GitHub Actions
Waiting
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #807.
With compression enabled in a Next.js Pages API route, creating a tus upload can return
201 Createdwith noLocationheader. The bundled compression middleware misreads the flat header array supplied bysrvx, so the client loses the URL it needs to resume the upload.For HTTP/1 Pages API responses with a wrapped
writeHead, this change passes the headers to middleware as an object at the pointsrvxwrites them. Repeated headers keep their separate values. Writing at that point also lets a download stream that fails before its first bytes return HTTP 500. Regression tests cover upload creation, early stream errors, and multipleSet-Cookievalues.Verification
@tus/server2.4.7 and the Pages API resolvers from Next.js 15.5.4 and 16.4.6. With the patch, a client created an upload, sent the first chunk, read its offset withHEAD, and sent the remaining bytes. The stored file matched the original with compression both enabled and disabled.