Skip to content

Commit

Permalink
chore(graphql-model-transformer): use lodash for accessing deep objec…
Browse files Browse the repository at this point in the history
…t property (#8374)
  • Loading branch information
lazpavel authored Oct 7, 2021
1 parent 2bdae3a commit 829a6fb
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { isAmplifyAdminApp } from './utils/admin-helpers';
import { JSONUtilities, stateManager } from 'amplify-cli-core';
import { ResourceConstants } from 'graphql-transformer-common';
import { printer } from 'amplify-prompts';
import _ from 'lodash';

import {
collectDirectivesByTypeNames,
Expand Down Expand Up @@ -58,11 +59,11 @@ export function searchablePushChecks(context, map, apiName): void {
if (searchableModelTypes.length) {
const currEnv = context.amplify.getEnvInfo().envName;
const teamProviderInfo = stateManager.getTeamProviderInfo();
const apiCategory = teamProviderInfo[currEnv]?.categories?.api?.[apiName];
const instanceType =
apiCategory && apiCategory[ResourceConstants.PARAMETERS.ElasticsearchInstanceType]
? apiCategory[ResourceConstants.PARAMETERS.ElasticsearchInstanceType]
: 't2.small.elasticsearch';
const instanceType = _.get(
teamProviderInfo,
[currEnv, 'categories', 'api', apiName, ResourceConstants.PARAMETERS.ElasticsearchInstanceType],
't2.small.elasticsearch',
);
if (instanceType === 't2.small.elasticsearch' || instanceType === 't3.small.elasticsearch') {
printer.warn(
`Your instance type for OpenSearch is ${instanceType}, you may experience performance issues or data loss. Consider reconfiguring with the instructions here https://docs.amplify.aws/cli/graphql-transformer/searchable/`,
Expand Down

0 comments on commit 829a6fb

Please sign in to comment.