mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(Google BigQuery Node): Location default to jobReference (#7354)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
parent
1dfa052301
commit
97bb703d0a
|
@ -7,7 +7,7 @@ import type {
|
|||
|
||||
import { NodeOperationError, sleep } from 'n8n-workflow';
|
||||
import { getResolvables, updateDisplayOptions } from '@utils/utilities';
|
||||
import type { JobInsertResponse } from '../../helpers/interfaces';
|
||||
import type { ResponseWithJobReference } from '../../helpers/interfaces';
|
||||
|
||||
import { prepareOutput } from '../../helpers/utils';
|
||||
import { googleApiRequest } from '../../transport';
|
||||
|
@ -205,7 +205,7 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
|||
body.useLegacySql = false;
|
||||
}
|
||||
|
||||
const response: JobInsertResponse = await googleApiRequest.call(
|
||||
const response: ResponseWithJobReference = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/v2/projects/${projectId}/jobs`,
|
||||
|
@ -225,9 +225,10 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
|||
|
||||
const jobId = response?.jobReference?.jobId;
|
||||
const raw = rawOutput || (options.dryRun as boolean) || false;
|
||||
const location = options.location || response.jobReference.location;
|
||||
|
||||
if (response.status?.state === 'DONE') {
|
||||
const qs = options.location ? { location: options.location } : {};
|
||||
const qs = { location };
|
||||
|
||||
const queryResponse: IDataObject = await googleApiRequest.call(
|
||||
this,
|
||||
|
@ -239,7 +240,7 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
|||
|
||||
returnData.push(...prepareOutput.call(this, queryResponse, i, raw, includeSchema));
|
||||
} else {
|
||||
jobs.push({ jobId, projectId, i, raw, includeSchema, location: options.location });
|
||||
jobs.push({ jobId, projectId, i, raw, includeSchema, location });
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
|
|
|
@ -21,7 +21,7 @@ export type JobReference = {
|
|||
location: string;
|
||||
};
|
||||
|
||||
export type JobInsertResponse = {
|
||||
export type ResponseWithJobReference = {
|
||||
kind: string;
|
||||
id: string;
|
||||
jobReference: JobReference;
|
||||
|
|
Loading…
Reference in a new issue