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

Getting java.net.UnknownHostException: Unable to resolve host "cognito-idp.ap-south-1.amazonaws.com": No address associated with hostname #2864

Closed
1 task done
Manav122000 opened this issue Jun 29, 2024 · 3 comments
Labels
question General question

Comments

@Manav122000
Copy link

Manav122000 commented Jun 29, 2024

Before opening, please confirm:

Language and Async Model

Kotlin

Amplify Categories

Authentication

Gradle script dependencies

implementation("com.amplifyframework.ui:authenticator:1.2.0")
implementation("com.amplifyframework:core:1.28.1")
implementation("com.amplifyframework:aws-auth-cognito:1.28.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.0")
implementation("com.amplifyframework:aws-api:2.19.1")

Environment information

------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------

Build time:   2024-03-22 15:52:46 UTC
Revision:     650af14d7653aa949fce5e886e685efc9cf97c10

Kotlin:       1.9.22
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          1.8.0_131 (Azul Systems, Inc. 25.131-b11)
OS:           Mac OS X 10.16 x86_64


Please include any relevant guides or documentation you're referencing

#2542

Describe the bug

I have been getting java.net.UnknownHostException: Unable to resolve host "cognito-idp.ap-south-1.amazonaws.com": No address associated with hostname, recoverySuggestion=Sorry, we don’t have a recovery suggestion for this error. exception while trying to develop a mobile application while executing Step 6(Implement login UI).

Reproduction steps (if applicable)

No response

Code Snippet

I have been referring to this [documentation](https://docs.amplify.aws/android/start/quickstart)

Log output

// Put your logs below this line


amplifyconfiguration.json

{
  "auth": {
    "user_pool_id": "ap-south-1_************",
    "aws_region": "ap-south-1",
    "user_pool_client_id": "***************",
    "identity_pool_id": "ap-south-1:***************",
    "standard_required_attributes": [
      "email"
    ],
    "username_attributes": [
      "email"
    ],
    "user_verification_types": [
      "email"
    ],
    "password_policy": {
      "min_length": 8,
      "require_numbers": true,
      "require_lowercase": true,
      "require_uppercase": true,
      "require_symbols": true
    },
    "unauthenticated_identities_enabled": true
  },
  "data": {
    "url": "https://******************.appsync-api.ap-south-1.amazonaws.com/graphql",
    "aws_region": "ap-south-1",
    "api_key": "*************",
    "default_authorization_type": "API_KEY",
    "authorization_types": [
      "AMAZON_COGNITO_USER_POOLS",
      "AWS_IAM"
    ],
    "model_introspection": {
      "version": 1,
      "models": {
        "Todo": {
          "name": "Todo",
          "fields": {
            "id": {
              "name": "id",
              "isArray": false,
              "type": "ID",
              "isRequired": true,
              "attributes": []
            },
            "content": {
              "name": "content",
              "isArray": false,
              "type": "String",
              "isRequired": false,
              "attributes": []
            },
            "createdAt": {
              "name": "createdAt",
              "isArray": false,
              "type": "AWSDateTime",
              "isRequired": false,
              "attributes": [],
              "isReadOnly": true
            },
            "updatedAt": {
              "name": "updatedAt",
              "isArray": false,
              "type": "AWSDateTime",
              "isRequired": false,
              "attributes": [],
              "isReadOnly": true
            }
          },
          "syncable": true,
          "pluralName": "Todos",
          "attributes": [
            {
              "type": "model",
              "properties": {}
            },
            {
              "type": "auth",
              "properties": {
                "rules": [
                  {
                    "allow": "public",
                    "provider": "apiKey",
                    "operations": [
                      "create",
                      "update",
                      "delete",
                      "read"
                    ]
                  }
                ]
              }
            }
          ],
          "primaryKeyInfo": {
            "isCustomPrimaryKey": false,
            "primaryKeyFieldName": "id",
            "sortKeyFieldNames": []
          }
        }
      },
      "enums": {},
      "nonModels": {}
    }
  },
  "version": "1"
}

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

@github-actions github-actions bot added the pending-triage Issue is pending triage label Jun 29, 2024
@tylerjroach
Copy link
Member

Sorry if this sounds like a simple question, but does your device have internet connection? UnknownHostException will be seen when the device is completely disconnected from internet.

Another issue could be that the device time is set incorrectly, proxy is blocking url, etc.

If none of these issues are present, please reply with the amplify version being used, and code snippets to how Amplify is being configured and login code being used.

@tylerjroach tylerjroach added question General question and removed pending-triage Issue is pending triage labels Jul 1, 2024
@mattcreaser mattcreaser added the pending-community-response Issue is pending response from the issue requestor label Jul 2, 2024
@phantumcode
Copy link
Member

@Manav122000 Were you able to resolve your issue? A couple clarification questions, is your amplify configuration file named amplifyconfiguration.json or amplify_outputs.json? Based on the content and format, it appears to be the amplify_outputs.json, so it should be named correctly and passed into the Amplify like so Amplify.configure(AmplifyOutputs( R.raw.amplify_outputs), applicationContext)

Also, it looks like the configuration is missing two fields. Can you regenerate or download the last amplify_outputs file and make sure it's up to date and has the following fields for auth? "mfa_methods": [], "mfa_configuration": "OFF",

@github-actions github-actions bot removed the pending-community-response Issue is pending response from the issue requestor label Jul 22, 2024
@phantumcode phantumcode added pending-community-response Issue is pending response from the issue requestor closing soon This issue will be closed in 7 days unless further comments are made. labels Jul 30, 2024
@github-actions github-actions bot removed pending-community-response Issue is pending response from the issue requestor closing soon This issue will be closed in 7 days unless further comments are made. labels Aug 7, 2024
Copy link
Contributor

github-actions bot commented Aug 7, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question
Projects
None yet
Development

No branches or pull requests

4 participants