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

AppSync realtime endpoint URL is not correct for AWS China regions #2945

Closed
1 task done
wulianer opened this issue Nov 12, 2024 · 5 comments
Closed
1 task done

AppSync realtime endpoint URL is not correct for AWS China regions #2945

wulianer opened this issue Nov 12, 2024 · 5 comments
Assignees
Labels
api bug Something isn't working

Comments

@wulianer
Copy link

Before opening, please confirm:

Language and Async Model

Java

Amplify Categories

GraphQL API

Gradle script dependencies

// Put output below this line

Environment information

# Put output below this line


Please include any relevant guides or documentation you're referencing

No response

Describe the bug

Working on Android projects with AWS China service region. The AppSync Query/Mutation methods work well but no subscription method works. Looking into the network traffic detail, I found that the Amplify SDK mistakenly processes the AWS China's realtime endpoint URL to a not existing endpoint URL thus causes the subscription failure . Below is the block of source code that needs update:

private val standardEndpointRegex =
    "^https://\\w{26}\\.appsync-api\\.\\w{2}(?:-\\w{2,})+-\\d\\.amazonaws.com/graphql$".toRegex()
    
 private val realtime by lazy {
        if (standardEndpointRegex.matches(urlString)) {
            // For standard URLs we insert "realtime" into the domain
            URL(urlString.replace("appsync-api", "appsync-realtime-api"))
        } else {
            // For custom URLs we append "realtime" to the path
            URL("$urlString/realtime")
        }
    }   

All AWS China region AppSync endpoint URLs end with amazonaws.com.cn thus they will not met the stanadardEndpointRegex and will be added /realtime. This is not correct for these URLs.

Besides above code snippet, there are multiple places that have this similar logic to check if an endpoint is a custom domain URL. All of them need update to support China AWS region

Reproduction steps (if applicable)

No response

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 12, 2024
@mattcreaser
Copy link
Member

Hi @wulianer, thanks for the report. We'll check with the AppSync team about this and get back to you.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 12, 2024
@mattcreaser mattcreaser added bug Something isn't working api labels Nov 12, 2024
@github-actions github-actions bot removed the pending-triage Issue is pending triage label Nov 12, 2024
@mattcreaser mattcreaser self-assigned this Nov 14, 2024
@mattcreaser mattcreaser added the pending-release Code has been merged but pending release label Nov 15, 2024
@mattcreaser
Copy link
Member

The fix for this issue has been merged and will be included in our next release.

@wulianer
Copy link
Author

Thank you for the quick response for the fix! @mattcreaser

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 21, 2024
@mattcreaser
Copy link
Member

This fix has been released in Amplify 2.24.1. Please let us know if you have any issues!

@github-actions github-actions bot removed pending-maintainer-response Issue is pending response from an Amplify team member pending-release Code has been merged but pending release labels Nov 21, 2024
Copy link
Contributor

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
api bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants