• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

serverless-nextjs / serverless-next.js / 1034
91%

Build:
DEFAULT BRANCH: master
Ran 04 Apr 2020 01:57PM UTC
Jobs 2
Files 34
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
1034

push

travis-ci-com

web-flow
fix(serverless-next.js): Fix the issue with TypeError hasHeader is not a function (#342)

* Fix the issue with TypeError hasHeader is not a function

When deploying to netlify or AWS (both depend on AWS-lambda)
The SSR components (using `getServerSideProps` fails with the following
error:
```
  ERROR	TypeError: res.hasHeader is not a function
    at sendPayload (/var/task/pages/test.js:5787:41)
    at renderReqToHTML (/var/task/pages/test.js:1773:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Module.render (/var/task/pages/test.js:1816:22)
```
This is caused by nextjs trying to use the default node `hasHeader`
method here: https://github.com/zeit/next.js/blob/v9.3.1/packages/next/next-server/server/send-payload.ts#L25

This commit fix the issue reported here: zeit/next.js#11223
which I could verify also happening on our stack by adding the method
that mimics the nodeJS method (using `res.getHeader(name)` internally wrapping it
in boolean response)

Previously fixed for next-aws-lambda in #329

* Fix the headers to always work with lower case

Previously the following behaviour could be observed:
```
res.setHeader("X-CUSTOM", "VAL")
res.getHeader("X-CUSTOM") => null
res.hasHeader("X-CUSTOM") => false

res.setHeader("x-custom", "val")
res.getHeader("X-CUSTOM") => "val"
res.hasHeader("X-CUSTOM") => true
```
There is no way of accessing a header that isn't set in lower case,
This fixes the issue by always storing the header name as lower case,
allowing a similar behaviour to node HTTP ResponseObject behaviour
 - https://nodejs.org/api/http.html#http_request_getheader_name
 - https://nodejs.org/api/http.html#http_request_removeheader_name
 - https://nodejs.org/api/http.html#http_request_setheader_name_value

Previously fixed for next-aws-lambda in #331

* Update the npm package-lock

328 of 358 branches covered (91.62%)

Branch coverage included in aggregate %.

925 of 945 relevant lines covered (97.88%)

107.61 hits per line

Jobs
ID Job ID Ran Files Coverage
5 1034.5 04 Apr 2020 01:57PM UTC 0
96.16
Travis Job 1034.5
6 1034.6 04 Apr 2020 01:59PM UTC 0
96.16
Travis Job 1034.6
Source Files on build 1034
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #1034
  • 20f42fdd on github
  • Prev Build on master (#1027)
  • Next Build on master (#1048)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc