Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Force http in the GAX module when using the GAX fallback and connecting to the emulator #1788

Merged
merged 4 commits into from Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 14 additions & 9 deletions dev/src/index.ts
Expand Up @@ -16,7 +16,7 @@

import * as firestore from '@google-cloud/firestore';

import type {CallOptions} from 'google-gax';
import type {CallOptions, ClientOptions} from 'google-gax';
import type * as googleGax from 'google-gax';
import type * as googleGaxFallback from 'google-gax/build/src/fallback';
import {Duplex, PassThrough, Transform} from 'stream';
Expand Down Expand Up @@ -580,14 +580,19 @@ export class Firestore implements firestore.Firestore {
const grpcModule = this._settings.grpc ?? require('google-gax').grpc;
const sslCreds = grpcModule.credentials.createInsecure();

client = new module.exports.v1(
{
sslCreds,
...this._settings,
fallback: useFallback,
},
gax
);
const settings: ClientOptions = {
sslCreds,
...this._settings,
fallback: useFallback,
};

// Since `ssl === false`, if we're using the GAX fallback then
// also set the `protocol` option for GAX fallback to force http
if (useFallback) {
settings.protocol = 'http';
}

client = new module.exports.v1(settings, gax);
} else {
client = new module.exports.v1(
{
Expand Down