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

Can't parse Timestamp string with 6 nano seconds #563

@MrLibya

Description

@MrLibya

Trying to appendRows on timestamp field with value of 2025-05-23T08:30:09.213503Z Will throw error

const appendRes = await writer
				.appendRows([
					{
						document_id: documentId,
						timestamp: '2025-05-23T08:30:09.213503Z',
					},
				])
				.getResult()

error message:

Error: interior hyphen
    at Function.fromString (/workspace/node_modules/long/umd/index.js:363:45)
    at Function.from (/workspace/node_modules/protobufjs/src/util/longbits.js:86:31)
    at BufferWriter.write_uint64 (/workspace/node_modules/protobufjs/src/writer.js:262:25)
    at Type.root$encode [as encode] (eval at Codegen (/workspace/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:11:16)
    at Type.encode_setup [as encode] (/workspace/node_modules/protobufjs/src/type.js:506:25)
    at JSONEncoder.encodeRow (/workspace/node_modules/@google-cloud/bigquery-storage/build/src/managedwriter/encoder.js:77:27)
    at /workspace/node_modules/@google-cloud/bigquery-storage/build/src/managedwriter/encoder.js:68:25
    at Array.map (<anonymous>)
    at JSONEncoder.encodeRows (/workspace/node_modules/@google-cloud/bigquery-storage/build/src/managedwriter/encoder.js:67:14)
    at JSONWriter.appendRows (/workspace/node_modules/@google-cloud/bigquery-storage/build/src/managedwriter/json_writer.js:93:46)

Note that when I wrap the value in Date it work fine, But the nanosecond will be lost with date:

new Date('2025-05-23T08:30:09.213503Z')

Metadata

Metadata

Assignees

Labels

api: bigquerystorageIssues related to the googleapis/nodejs-bigquery-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions