Incomplete job metadata when quering BigQuery using Node client

Hey,

We use the Node.js client to query BigQuery with a query job. Afterward, we access job.metadata.statistics to read metadata such as startTime, endTime, and query.totalBytesBilled. However, sometimes these fields are not defined, even though there are no errors and results are returned. We haven’t been able to reliably replicate this issue.

Why might the job metadata be incomplete for successful queries?

Reference code:

const [job] = await bigQueryClient.createQueryJob({query})
const results = await job.getQueryResults()
// job.metadata.statistics sometimes doesn't contain startTime, endTime, query.totalBytesBilled