google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

HTTP/2 option ignore timeout option

Open gring2 opened this issue 2 years ago • 3 comments

Environment details

  • OS:
  • Node.js version: 18.15.0
  • npm version: 9.5.0
  • googleapis version: 112.0.0

Steps to reproduce

  1. set http2 and timeout options to google.options
google.options({http2: true, timeout: 1})
  1. send any request to google apis
google.calendar().events.list({calendarId: ${calendarId}})

I expect api request fails.because it has very short timeout but i got response successfully unlike request through HTTP/1.1 I guess googleapi-common library does not fully support options. because I tested googleapi-common http2 module, the module ignored timeout config.

test code comparing http2 module to node-fetch module

import { request } from 'googleapis-common/build/src/http2';
import nodefetch from 'node-fetch';

request({
  timeout: 1,
  url: 'https://www.google.com',
  headers: { timeout: 1 },
}).then((r) => {
  console.log(r);
});

nodefetch('https://www.google.com', { timeout: 1 }).catch(console.error);

gring2 avatar Mar 15 '23 03:03 gring2

I tracked down the underlying cause and it turns out there is some type confusion between the options that common.http2 accepts and the options ClientHttp2Session which makes the underlying calls accepts. The above mentioned issue will need to be resolved before this issue can be closed. Going to bump the priority of this down in the meantime.

ddelgrosso1 avatar Apr 17 '23 18:04 ddelgrosso1

Changing to feature request as things work as intended but there is a lot of mixing of types and arguments that could be handled a lot better.

ddelgrosso1 avatar Oct 11 '23 15:10 ddelgrosso1

Thank you for your work.

if this problem is solved it will be great help to improve my user experience.

gring2 avatar Oct 28 '23 01:10 gring2