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

HTTP/2 TypeError(s) #46538

Open
khteh opened this issue Feb 7, 2023 · 2 comments
Open

HTTP/2 TypeError(s) #46538

khteh opened this issue Feb 7, 2023 · 2 comments

Comments

@khteh
Copy link

khteh commented Feb 7, 2023

Version

v19.6.0

Platform

Linux khteh-p15v-3i 5.19.0-29-generic #30-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 4 12:14:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

const app = next({ dev, dir: __dirname })
app.prepare().then(() => {
  // express setup
  const expressApp = express()
  expressApp.use(express.json())
  expressApp.use(express.urlencoded({ extended: false }))
  expressApp.use(cookieParser())
  expressApp.use(express.static(path.join(__dirname, 'public')))
  //expressApp.use(helmet()) adding set of security middlewares. This breaks!
  expressApp.use(cors()) // enable all CORS request
  expressApp.set('port', port)
  expressApp.use(compression({ filter: shouldCompress }))
  const server = http2.createSecureServer({
    key: fs.readFileSync('server.key'),
    cert: fs.readFileSync('server.crt')
  }, expressApp);
})

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

error - uncaughtException: TypeError: Cannot read properties of undefined (reading 'readable')
    at IncomingMessage._read (node:_http_incoming:214:19)
    at Readable.read (node:internal/streams/readable:496:12)
    at resume_ (node:internal/streams/readable:999:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
error - uncaughtException: TypeError: Cannot convert undefined or null to object
    at ServerResponse.removeHeader (node:_http_outgoing:813:30)
    at Immediate.write (/usr/src/myapp/node_modules/finalhandler/index.js:282:9)
    at process.processImmediate (node:internal/timers:477:21)
error - uncaughtException: TypeError: Cannot read properties of undefined (reading 'readable')
    at IncomingMessage._read (node:_http_incoming:214:19)
    at Readable.read (node:internal/streams/readable:496:12)
    at resume_ (node:internal/streams/readable:999:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
error - uncaughtException: TypeError: Cannot convert undefined or null to object
    at ServerResponse.removeHeader (node:_http_outgoing:813:30)
    at Immediate.write (/usr/src/myapp/node_modules/finalhandler/index.js:282:9)
    at process.processImmediate (node:internal/timers:477:21)
error - uncaughtException: TypeError: Cannot read properties of undefined (reading 'readable')
    at IncomingMessage._read (node:_http_incoming:214:19)
    at Readable.read (node:internal/streams/readable:496:12)
    at resume_ (node:internal/streams/readable:999:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
error - uncaughtException: TypeError: Cannot convert undefined or null to object
    at ServerResponse.removeHeader (node:_http_outgoing:813:30)
    at Immediate.write (/usr/src/myapp/node_modules/finalhandler/index.js:282:9)
    at process.processImmediate (node:internal/timers:477:21)

Additional information

No response

@marco-ippolito
Copy link
Member

can you provide an example without express? I'm afraid the problem is in the interation between http2 server and express

@khteh
Copy link
Author

khteh commented Mar 3, 2023

Can you provide an example of using http2 without using express with React.JS/Next.JS application? I tried but no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants