Skip to content

Commit

Permalink
fix(atlas-service): use metricsId for clusterId when doing automation…
Browse files Browse the repository at this point in the history
… agent requests
  • Loading branch information
gribnoysup committed Sep 26, 2024
1 parent fa9be31 commit 1cb8745
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/atlas-service/src/atlas-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ export class AtlasService {
automationAgentFetch<OpType extends keyof AutomationAgentRequestTypes>(
atlasMetadata: Pick<
AtlasClusterMetadata,
'projectId' | 'clusterUniqueId' | 'regionalBaseUrl' | 'metricsType'
| 'projectId'
| 'clusterUniqueId'
| 'regionalBaseUrl'
| 'metricsType'
| 'metricsId'
>,
opType: OpType,
opBody: Omit<
Expand All @@ -118,7 +122,7 @@ export class AtlasService {
const opBodyClusterId =
atlasMetadata.metricsType === 'serverless'
? { serverlessId: atlasMetadata.clusterUniqueId }
: { clusterId: atlasMetadata.clusterUniqueId };
: { clusterId: atlasMetadata.metricsId };
return makeAutomationAgentOpRequest(
this.authenticatedFetch.bind(this),
this.regionalizedCloudEndpoint(atlasMetadata),
Expand Down
4 changes: 3 additions & 1 deletion packages/compass-web/scripts/start-electron-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ const child_process = require('child_process');
const electronPath = require('electron');

function startElectronProxy() {
child_process.execFile(
const child = child_process.execFile(
electronPath,
[path.resolve(__dirname, 'electron-proxy.js')],
{ env: process.env }
);
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
}

module.exports = { startElectronProxy };
10 changes: 7 additions & 3 deletions packages/compass-web/src/connection-storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,13 @@ class AtlasCloudConnectionStorage
});
}

loadAll(): Promise<ConnectionInfo[]> {
return (this.loadAllPromise ??=
this._loadAndNormalizeClusterDescriptionInfo());
async loadAll(): Promise<ConnectionInfo[]> {
try {
return (this.loadAllPromise ??=
this._loadAndNormalizeClusterDescriptionInfo());
} finally {
delete this.loadAllPromise;
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions packages/compass-web/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ module.exports = async (env, args) => {
tls: localPolyfill('tls'),
},
},
plugins: [
new webpack.DefinePlugin({
// Matches the electron-proxy.js default value
'process.env.COMPASS_WEB_HTTP_PROXY_CLOUD_CONFIG': JSON.stringify(
process.env.COMPASS_WEB_HTTP_PROXY_CLOUD_CONFIG ?? 'dev'
),
}),
],
});
}

Expand Down

0 comments on commit 1cb8745

Please sign in to comment.