Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

TypeError when inserting an object with null prototype #1196

@jfhr

Description

@jfhr

Environment details

  • OS: MacOS 13.2.1
  • Node.js version: v18.10
  • npm version: 8.19.2
  • @google-cloud/bigquery version: 6.1.0

Steps to reproduce

  1. Create an object with Object.create(null)
  2. Give the object any properties with BigQuery-compatible names and values
  3. Create a stream with new BigQuery().dataset('...').table('...').createInsertStream()
  4. Write the object to the stream

This causes a TypeError: Cannot read properties of undefined (reading 'name')

This is cause by line 573 in table.ts, which reads:

    const constructorName = value.constructor.name;

For an object created with Object.create(null), constructor is undefined so this causes an error.

Suggestion: Change this line to:

    const constructorName = value.constructor?.name;

This should allow it to handle null constructor objects without changing anything for other types.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/nodejs-bigquery API.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