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 1 commit
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: 15 additions & 8 deletions dev/src/index.ts
Expand Up @@ -580,14 +580,21 @@ 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
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
MarkDuckworth marked this conversation as resolved.
Show resolved Hide resolved
const settings: any = {
MarkDuckworth marked this conversation as resolved.
Show resolved Hide resolved
sslCreds,
...this._settings,
fallback: useFallback,
};

// If `ssl === false` and we're using the GAX fallback,
MarkDuckworth marked this conversation as resolved.
Show resolved Hide resolved
MarkDuckworth marked this conversation as resolved.
Show resolved Hide resolved
// also set the `protocol` option for GAX fallback to
// force http
if (useFallback) {
settings['protocol'] = 'http';
MarkDuckworth marked this conversation as resolved.
Show resolved Hide resolved
}

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