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
Before opening, please confirm:
Language and Async Model
Java
Amplify Categories
GraphQL API
Gradle script dependencies
Environment information
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:
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
Log output
amplifyconfiguration.json
No response
GraphQL Schema
Additional information and screenshots
No response