Skip to content

table.getRows throws TypeError: Cannot read properties of undefined (reading 'fields') #1452

Closed
@kirstu

Description

@kirstu

Please make sure you have searched for information in the following guides.

A screenshot that you have tested with "Try this API".

This is provably a client error as it happens only post version 7.9.2

Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.

https://gist.github.com/kirstu/2d343883f04c7f29fc8f065b9f6928e1

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

  1. Follow steps in https://cloud.google.com/bigquery/docs/paging-results#iterate_through_client_libraries_results
  2. Observe error: "Cannot read properties of undefined (reading 'fields')"

Error is thrown from mergeSchemaWithRows_ function here. Most likely happens because this.metadata.schema is undefined here

Full stack trace

TypeError: Cannot read properties of undefined (reading 'fields')
      at Function.mergeSchemaWithRows_ (node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/bigquery/build/src/bigquery.js:305:35)
      at onComplete (node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/bigquery/build/src/table.js:972:32)
      at node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/bigquery/build/src/table.js:1007:13
      at node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/common/build/src/util.js:412:25
      at Util.handleResp (node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/common/build/src/util.js:161:9)
      at node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/common/build/src/util.js:534:22
      at onResponse (node_modules/.pnpm/[email protected]/node_modules/retry-request/index.js:259:7)
      at /Volumes/Dev/pasisalo/Projects/hox/node_modules/.pnpm/[email protected]/node_modules/teeny-request/src/index.ts:320:13

A clear and concise description of what the bug is, and what you expected to happen.

table.getRows should return a response, instead an error is thrown

A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

The change introduced in release 7.9.2 is causing the issue. Version prior to 7.9.2 work just as expected. From the linked commit it's pretty obvious why the error happens.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/nodejs-bigquery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions