diff --git a/src/commands/launch/logs.ts b/src/commands/launch/logs.ts index daf23db..96a50ee 100755 --- a/src/commands/launch/logs.ts +++ b/src/commands/launch/logs.ts @@ -136,15 +136,15 @@ export default class Logs extends BaseCommand { uid, deployments, })); - this.sharedConfig.environment = await ux - .inquire({ - type: 'search-list', - name: 'Environment', - choices: environments, - message: 'Choose an environment', - }) - .then((name: any) => (find(environments, { name }) as Record)?.uid); - this.sharedConfig.currentConfig.deployments = environments[0]?.deployments?.edges; + const selectedName = await ux.inquire({ + type: 'search-list', + name: 'Environment', + choices: environments, + message: 'Choose an environment', + }); + const selectedEnvironment = find(environments, { name: selectedName }) as Record | undefined; + this.sharedConfig.environment = selectedEnvironment?.uid; + this.sharedConfig.currentConfig.deployments = selectedEnvironment?.deployments?.edges; } /** diff --git a/src/graphql/queries.ts b/src/graphql/queries.ts index 97b6cdc..407fcd8 100755 --- a/src/graphql/queries.ts +++ b/src/graphql/queries.ts @@ -140,8 +140,8 @@ const deploymentLogsQuery: DocumentNode = gql` `; const serverlessLogsQuery: DocumentNode = gql` - query GetServerlessLogs($query: QueryLogMessagesInputType!) { - getServerlessLogs(query: $query) { + query GetServerlessLogsV2($query: QueryLogMessagesV2InputType!) { + getServerlessLogsV2(query: $query) { logs { source message diff --git a/src/util/logs-polling-utilities.ts b/src/util/logs-polling-utilities.ts index c05f593..5536309 100755 --- a/src/util/logs-polling-utilities.ts +++ b/src/util/logs-polling-utilities.ts @@ -308,7 +308,7 @@ export default class LogPolling { serverLogsWatchQuery.stopPolling(); } - const logsData = data?.getServerlessLogs?.logs; + const logsData = data?.getServerlessLogsV2?.logs; const logsLength = logsData?.length; if (logsLength > 0) { this.loader=cliux.loaderV2('done', this.loader); diff --git a/test/unit/util/logs-polling-utilities.test.ts b/test/unit/util/logs-polling-utilities.test.ts index 8706818..0fcfc03 100644 --- a/test/unit/util/logs-polling-utilities.test.ts +++ b/test/unit/util/logs-polling-utilities.test.ts @@ -162,7 +162,7 @@ describe('LogPolling', () => { const serverLogsWatchQuery = { subscribe: sandbox.stub().callsFake((callback) => { const logsData = { - getServerlessLogs: { + getServerlessLogsV2: { logs: [{ timestamp: '2023-05-26T10:00:00Z' }, { timestamp: '2023-05-26T10:00:01Z' }], }, };