mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -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 { NodeOperationError, sleep } from 'n8n-workflow';
|
||||||
import { getResolvables, updateDisplayOptions } from '@utils/utilities';
|
import { getResolvables, updateDisplayOptions } from '@utils/utilities';
|
||||||
import type { JobInsertResponse } from '../../helpers/interfaces';
|
import type { ResponseWithJobReference } from '../../helpers/interfaces';
|
||||||
|
|
||||||
import { prepareOutput } from '../../helpers/utils';
|
import { prepareOutput } from '../../helpers/utils';
|
||||||
import { googleApiRequest } from '../../transport';
|
import { googleApiRequest } from '../../transport';
|
||||||
|
@ -205,7 +205,7 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
||||||
body.useLegacySql = false;
|
body.useLegacySql = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response: JobInsertResponse = await googleApiRequest.call(
|
const response: ResponseWithJobReference = await googleApiRequest.call(
|
||||||
this,
|
this,
|
||||||
'POST',
|
'POST',
|
||||||
`/v2/projects/${projectId}/jobs`,
|
`/v2/projects/${projectId}/jobs`,
|
||||||
|
@ -225,9 +225,10 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
||||||
|
|
||||||
const jobId = response?.jobReference?.jobId;
|
const jobId = response?.jobReference?.jobId;
|
||||||
const raw = rawOutput || (options.dryRun as boolean) || false;
|
const raw = rawOutput || (options.dryRun as boolean) || false;
|
||||||
|
const location = options.location || response.jobReference.location;
|
||||||
|
|
||||||
if (response.status?.state === 'DONE') {
|
if (response.status?.state === 'DONE') {
|
||||||
const qs = options.location ? { location: options.location } : {};
|
const qs = { location };
|
||||||
|
|
||||||
const queryResponse: IDataObject = await googleApiRequest.call(
|
const queryResponse: IDataObject = await googleApiRequest.call(
|
||||||
this,
|
this,
|
||||||
|
@ -239,7 +240,7 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
||||||
|
|
||||||
returnData.push(...prepareOutput.call(this, queryResponse, i, raw, includeSchema));
|
returnData.push(...prepareOutput.call(this, queryResponse, i, raw, includeSchema));
|
||||||
} else {
|
} else {
|
||||||
jobs.push({ jobId, projectId, i, raw, includeSchema, location: options.location });
|
jobs.push({ jobId, projectId, i, raw, includeSchema, location });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ export type JobReference = {
|
||||||
location: string;
|
location: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type JobInsertResponse = {
|
export type ResponseWithJobReference = {
|
||||||
kind: string;
|
kind: string;
|
||||||
id: string;
|
id: string;
|
||||||
jobReference: JobReference;
|
jobReference: JobReference;
|
||||||
|
|
Loading…
Reference in a new issue