Skip to content

http2 POST requests deadlock, wrong queryParameters serialization #775

@lglapinski

Description

@lglapinski
  1. Is this a client library issue or a product issue?
    Client library issue

  2. Did someone already solve this?
    No

  3. Do you have a support contract?
    No

Environment details

  • OS: MacOs 12.5.1
  • Node.js version: 16.16.0 LTS
  • npm version: 8.14.0
  • googleapis-common version: 6.0.1

Steps to reproduce

  1. Set Gmail API options to use http2 request
  2. Call gmailApi.users.threads.modify with valid parameters.
  3. Observe app being #deadlocked
  4. Notice query parameter removeLabelIds[]=... instead of removeLabelIds=...&removeLabelIds=...

Solution proposals

Solution to deadlock is to change this lines into

if (config.data) {
      if (config.data instanceof stream_1.Stream) {
          config.data.pipe(req);
      }
      else if (typeof config.data === 'string') {
          const data = Buffer.from(config.data);
          req.write(data);
      }
      else if (typeof config.data === 'object') {
          const data = JSON.stringify(config.data);
          req.write(data);
      } 
}
req.end();

Solution for wrong queryParameters serialization is to change this line into const q = opts.paramsSerializer(opts.params);

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions