amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

An error occurred during the push operation: / Inaccessible host

Open mnikolic10 opened this issue 4 years ago • 10 comments

Before opening, please confirm:

  • [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • [X] I have searched for duplicate or closed issues.
  • [X] I have read the guide for submitting bug reports.
  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

16.1.0

Amplify CLI Version

8.3.0

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Amplify Categories

Not applicable

Amplify Commands

push

Describe the bug

In attempting to migrate. to the v2 transformers, upon running 'amplify push', i run into the following error and output from the CLI:

An error occurred during the push operation: / Inaccessible host: amplify-lacarte-lacarteenv-122559-deployment.s3.ap-southeast-2.amazonaws.com' at port undefined'. This service may not be available in the `ap-southeast-2' region.

Following this, I am unable to run 'amplify push' again unless i delete deployment-state.json from S3.

Subsequently, for whatever reason, every time I run 'amplify push' and it begins 'updating files', my internet also dies out...

Seems to be related to the issue as I am able to reproduce it consecutively.

I was able to run 'amplify migrate api' successfully and convert my schema to the new format. Strangely enough, the 'amplify push' was successful on one occasion and it partially updated my environment.

I am now also unable to revert to the v1 transformers as the above issue occurs again when I modify cli.json to version 1 and run the 'amplify push' command again.

Any help would be appreciated!

Expected behavior

Running 'amplify push' would update the environment with the new migrations.

Reproduction steps

  1. Run 'amplify migrate api' to update schema to new format
  2. Run 'amplify push'
  3. At 'Updating Files' phase, error occurs & internet loses connection.

GraphQL schema(s)

# Put schemas below this line
type Global @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  about: String
  contentColour: String
  _geoloc: Geolocation
  type: ContentType
  diameter: Float
  continents: [Continent] @hasMany
  countries: [Country] @hasMany
  states: [State] @hasMany
  cities: [City] @hasMany
  suburbs: [Suburb] @hasMany
  restaurants: [Restaurant] @hasMany
  items: [Item] @hasMany
  drinks: [Drink] @hasMany
  images: [Image] @hasMany
  cuisines: [Cuisine] @hasMany
}

interface Locale {
  id: ID!
  name: String!
  about: String
  _geoloc: Geolocation
  type: ContentType
  diameter: Float
  parentLocationName: String
}

type Continent implements Locale @model @searchable @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  about: String
  continentRanking: Float
  contentColour: String
  _geoloc: Geolocation
  type: ContentType
  diameter: Float
  parentLocationName: String
  global: Global @belongsTo
  countries: [Country] @hasMany
  states: [State] @hasMany
  cities: [City] @hasMany
  suburbs: [Suburb] @hasMany
  restaurants: [Restaurant] @hasMany
  items: [Item] @hasMany
  drinks: [Drink] @hasMany
  images: [Image] @hasMany
  cuisines: [Cuisine] @hasMany
}

type Country implements Locale @model @searchable @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  about: String
  countryRanking: Float
  coverImage: String
  contentColour: String
  _geoloc: Geolocation
  polygon: Location
  type: ContentType
  diameter: Float
  parentLocationName: String
  global: Global @belongsTo
  continent: Continent @belongsTo
  states: [State] @hasMany
  cities: [City] @hasMany
  suburbs: [Suburb] @hasMany
  restaurants: [Restaurant] @hasMany
  items: [Item] @hasMany
  drinks: [Drink] @hasMany
  images: [Image] @hasMany
  cuisines: [Cuisine] @hasMany
}

type State implements Locale @model @searchable @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  about: String
  stateRanking: Float
  coverImage: String
  contentColour: String
  _geoloc: Geolocation
  type: ContentType
  diameter: Float
  parentLocationName: String
  global: Global @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  cities: [City] @hasMany
  suburbs: [Suburb] @hasMany
  restaurants: [Restaurant] @hasMany
  items: [Item] @hasMany
  drinks: [Drink] @hasMany
  images: [Image] @hasMany
  cuisines: [Cuisine] @hasMany
}

type City implements Locale @model @searchable @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  about: String
  cityRanking: Float
  coverImage: String
  contentColour: String
  _geoloc: Geolocation
  polygon: Location
  type: ContentType
  diameter: Float
  parentLocationName: String
  global: Global @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  state: State @belongsTo
  suburbs: [Suburb] @hasMany
  restaurants: [Restaurant] @hasMany
  items: [Item] @hasMany
  drinks: [Drink] @hasMany
  images: [Image] @hasMany
  cuisines: [Cuisine] @hasMany
}

type Suburb implements Locale @model @searchable @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  about: String
  suburbRanking: Float
  coverImage: String
  _geoloc: Geolocation
  type: ContentType
  diameter: Float
  parentLocationName: String
  global: Global @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  state: State @belongsTo
  city: City @belongsTo
  restaurants: [Restaurant] @hasMany
  items: [Item] @hasMany
  drinks: [Drink] @hasMany
  images: [Image] @hasMany
  cuisines: [Cuisine] @hasMany
}

type Restaurant @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  ranking: Float
  cuisine: String
  cuisineColor: String
  primaryImage: String
  location: String
  images: [Image] @hasMany
  itemList: [Item] @hasMany
  drinkList: [Drink] @hasMany
  menu: [Item] @hasMany
  section: [MenuSection] @hasMany
  drinks: [DrinksSection] @hasMany
  _geoloc: Geolocation
  type: [String]
  global: Global @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  state: State @belongsTo
  city: City @belongsTo
  suburb: Suburb @belongsTo
  details: RestaurantDetails
  priceRange: [Price]
  saved: Saved @belongsTo
}

type Item @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  cuisine: String
  price: String
  dishType: [String]
  dishColor: String
  description: String
  primaryImage: String
  restaurantName: String
  ranking: Float
  _geoloc: Geolocation
  priceRange: [Price]
  global: Global @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  state: State @belongsTo
  city: City @belongsTo
  suburb: Suburb @belongsTo
  saved: Saved @belongsTo
  menuSection: MenuSection @belongsTo
  restaurant: Restaurant @belongsTo
  images: [Image] @hasMany
  itemDetails: ItemDetails @hasOne
}

type Drink @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  price: String
  type: [String]
  typeColor: String
  description: String
  primaryImage: String
  restaurantName: String
  ranking: Float
  _geoloc: Geolocation
  priceRange: [Price]
  global: Global @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  state: State @belongsTo
  city: City @belongsTo
  suburb: Suburb @belongsTo
  saved: Saved @belongsTo
  restaurant: Restaurant @belongsTo
  drinkSection: DrinksSection @belongsTo
  images: [Image] @hasMany
  itemDetails: ItemDetails @hasOne
}

type Image @model @auth(rules: [{allow: private}]) {
  id: ID!
  thumbnail: String
  image: String
  type: ImageType
  description: String
  tags: [String]
  likes: Float
  global: Global @belongsTo
  restaurant: Restaurant @belongsTo
  item: Item @belongsTo
  drink: Drink @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  state: State @belongsTo
  city: City @belongsTo
  suburb: Suburb @belongsTo
}

type Cuisine @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String
  coverImage: String
  locations: [Float]
  global: Global @belongsTo
  continent: Continent @belongsTo
  country: Country @belongsTo
  state: State @belongsTo
  city: City @belongsTo
  suburb: Suburb @belongsTo
}

type MenuSection @model @auth(rules: [{allow: private}]) {
  id: ID!
  title: String
  description: String
  order: Int
  items: [Item] @hasMany
  restaurant: Restaurant @belongsTo
}

type DrinksSection @model @auth(rules: [{allow: private}]) {
  id: ID!
  title: String
  description: String
  order: Int
  items: [Drink] @hasMany
  restaurant: Restaurant @belongsTo
}

type RestaurantDetails {
  address: String
  website: String
  lowPrice: String
  highPrice: String
  phoneNumber: String
}

type ItemDetails @model @auth(rules: [{allow: private}]) {
  id: ID!
  description: String
  price: String
  dietary: [String]
  details: String
  item: Item @hasOne
  drink: Drink @hasOne
}

type User @model @auth(rules: [{allow: private}]) {
  id: ID!
  firstName: String
  lastName: String
  location: String
  picture: String
  username: String
  email: String
  description: String
  phoneNumber: String
  lastLocation: String
  saved: [Saved] @hasMany
  settings: Settings
  createdAt: AWSDateTime!
  updatedAt: AWSDateTime!
}

type Saved @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String
  primaryImage: [String]
  createdAt: AWSDateTime!
  updatedAt: AWSDateTime!
  user: User @belongsTo
  savedItems: [Item] @hasMany
  savedDrinks: [Drink] @hasMany
  savedPlaces: [Restaurant] @hasMany
}

type Geolocation {
  lat: Float
  lon: Float
}

type Location {
  type: String
  coordinates: [[[[Float]]]]
}

enum ContentType {
  Global
  Continent
  Country
  State
  City
  Suburb
}

enum Price {
  low
  moderate
  high
}

enum ImageType {
  Venue
  Dish
  Drink
}

type Type @model @auth(rules: [{allow: private}]) {
  id: ID!
  cuisine: String
  image: String
  locations: [Float]
}

enum LayoutSettings {
  list
  column
  double
}

enum SortOrder {
  az
  za
  recentlyAdded
  lastUpdated
}

type Settings {
  savedListLayout: LayoutSettings
  savedListSortOrder: SortOrder
}

type Mutation {
  batchDelete(ids: [ID!]): [Saved]
}

type Query {
  locateUser(location: LocateUserInput!): LocateConnection
  searchLocations(input: String!): LocalesConnection
}

input LocateUserInput {
  type: String!
  coordinates: [Float]!
}

type LocateConnection {
  items: [City]
  total: Int
  nextToken: String
}

type LocalesConnection {
  items: [Locale]
  total: Int
  nextToken: String
}

Log output

# Put your logs below this line


Additional information

mnikolic10 avatar May 24 '22 12:05 mnikolic10

Hey @mnikolic10 :wave: thanks for raising this! When migrating back to transformer v1 we will also want to change useexperimentalpipelinedtransformer to false, and we can confirm the manual migration back to v1 by running amplify api gql-compile.

I was able to run 'amplify migrate api' successfully and convert my schema to the new format. Strangely enough, the 'amplify push' was successful on one occasion and it partially updated my environment.

To clarify here, was the partial migration due to the loss of internet connectivity?

josefaidt avatar May 24 '22 16:05 josefaidt

Thanks for the prompt reply @josefaidt. No the partial migration had other errors, certain tables updated successfully and other had UPDATE_FAILED.

When migrating back to transformer v1 we will also want to change useexperimentalpipelinedtransformer to false, and we can confirm the manual migration back to v1 by running amplify api gql-compile.

Can confirm useexperimentalpipelinedtransformer was set to false in cli.json. I was able to run amplify api gql-compile and have my schema compile successfully (the same occurred when i ran amplify push), however the same error mentioned above still persists. Its strange, every time i run it my browser crashes...

mnikolic10 avatar May 25 '22 00:05 mnikolic10

Can confirm I am no longer encountering the above error (browser still crashes). I can now see the update failures, see below as an example:

UPDATE_FAILED SuburbTable AWS::DynamoDB::Table Wed May 25 2022 10:58:39 GMT+1000 (Australian Eastern Standard Time) Cannot perform more than one GSI creation or deletion in a single update You sent UPDATE_FAILED UpdateSuburbResolver AWS::AppSync::Resolver Wed May 25 2022 10:58:40 GMT+1000 (Australian Eastern Standard Time) Resource update cancelled
UPDATE_FAILED ListSuburbResolver AWS::AppSync::Resolver Wed May 25 2022 10:58:40 GMT+1000 (Australian Eastern Standard Time) Resource update cancelled
UPDATE_FAILED GetSuburbResolver AWS::AppSync::Resolver Wed May 25 2022 10:58:40 GMT+1000 (Australian Eastern Standard Time) Resource update cancelled
UPDATE_FAILED DeleteSuburbResolver AWS::AppSync::Resolver Wed May 25 2022 10:58:40 GMT+1000 (Australian Eastern Standard Time) Resource update cancelled
UPDATE_FAILED CreateSuburbResolver AWS::AppSync::Resolver Wed May 25 2022 10:58:40 GMT+1000 (Australian Eastern Standard Time) Resource update cancelled You sent An error occurred during the push operation: / ["Index: 0 State: {"deploy"😕"waitingForDeployment"} Message: Resource is not in the state stackUpdateComplete"]

I have enableiterativegsiupdates set to true.

potentially linked to this? https://github.com/aws-amplify/amplify-cli/issues/82#issuecomment-434016373

mnikolic10 avatar May 25 '22 01:05 mnikolic10

Hey @mnikolic10 thank you for clarifying and as a note, this line sticks out:

Cannot perform more than one GSI creation or deletion in a single update

Prior to migrating were there @key directives in your schema that were later changed in favor of the newer relationship directives like @hasMany?

josefaidt avatar May 25 '22 16:05 josefaidt

No, I wasn't using any @key directives, I do have quite a few @connection directives though.

mnikolic10 avatar May 25 '22 21:05 mnikolic10

@josefaidt any updates or recommendations? Keen to avoid having to recreate all of my tables

mnikolic10 avatar May 26 '22 22:05 mnikolic10

Hey @mnikolic10 can you share the contents of your amplify/cli.json file?

josefaidt avatar May 27 '22 19:05 josefaidt

@josefaidt sure, shared below:

{
  "features": {
    "graphqltransformer": {
      "addmissingownerfields": false,
      "improvepluralization": true,
      "validatetypenamereservedwords": true,
      "enableiterativegsiupdates": true,
      "secondarykeyasgsi": true,
      "skipoverridemutationinputtypes": false,
      "transformerversion": 2,
      "suppressschemamigrationprompt": true,
      "securityenhancementnotification": true,
      "showfieldauthnotification": false,
      "securityEnhancementNotification": false,
      "useexperimentalpipelinedtransformer": true
    },
    "frontend-ios": {
      "enablexcodeintegration": false
    },
    "auth": {
      "enablecaseinsensitivity": false,
      "useinclusiveterminology": false,
      "breakcirculardependency": false,
      "forcealiasattributes": false,
      "useenabledmfas": false
    },
    "codegen": {
      "useappsyncmodelgenplugin": true,
      "usedocsgeneratorplugin": false,
      "usetypesgeneratorplugin": false,
      "cleangeneratedmodelsdirectory": false,
      "retaincasestyle": false,
      "addtimestampfields": false,
      "handlelistnullabilitytransparently": false,
      "emitauthprovider": false,
      "generateindexrules": false,
      "enabledartnullsafety": false
    },
    "appsync": {
      "generategraphqlpermissions": false
    },
    "latestregionsupport": {
      "pinpoint": 0,
      "translate": 0,
      "transcribe": 0,
      "rekognition": 0,
      "textract": 0,
      "comprehend": 0
    },
    "project": {
      "overrides": true
    }
  }
}

mnikolic10 avatar May 28 '22 00:05 mnikolic10

Hey @mnikolic10 :wave: apologies for the delay here!! Thank you for posting the contents of your cli.json file, however everything looks good there. When you began receiving the failed updates regarding the multiple GSI changes, was this after migrating to v2 or after reverting the migration and going back to v1 of the GraphQL Transformer? Are you able to push the changes in increments?

josefaidt avatar Jun 13 '22 21:06 josefaidt

Hey @josefaidt no worries, It was in the initial push with V2 transformers. I have had to create a new amplify backend instance and migrate my data across. Was not able to get passed the above issue without data loss (hence why i opted to migrate).

Happy for you to close the issue.

mnikolic10 avatar Jun 14 '22 03:06 mnikolic10