aws-amplify/amplify-android

Re-Open #2945: AppSync realtime endpoint URL is not correct for AWS China regions

Closed this issue · 4 comments

Before opening, please confirm:

Language and Async Model

Kotlin

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

The latest 2.24.1 release note claims that it fixes the bug in ticket #2945 but actually it still exists.

This is the AppSync Endpoint URL (good for query/mutation methods):

https://6zjgfa5z5zh4ndlhyz12345678.appsync-api.cn-northwest-1.amazonaws.com.cn

This is the realtime Endpoint that the SDK 2.24.1 tries to access:

wss://6zjgfa5z5zh4ndlhyz12345678.appsync-api.cn-northwest-1.amazonaws.com.cn/graphql//realtime

which is not correct. It returns 404 and causes subscription failure.

The correct URL should be sth like this:

wss://6zjgfa5z5zh4ndlhyz12345678.appsync-realtime-api.cn-northwest-1.amazonaws.com.cn/graphql

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

Thank you for the report. We will take a look

@wulianer Can you provide a code snippet showing how you configured the CN region? I verified that the regex correctly identifies https://6zjgfa5z5zh4ndlhyz12345678.appsync-api.cn-northwest-1.amazonaws.com.cn as a "standard" endpoint and should generate the appsync-realtime-api domain but for some reason it's hitting the "custom" endpoint logic.

The smoking gun is this part of the endpoint that it's trying to hit: /graphql//realtime

The URL of the endpoint when it goes into the regex should not have a trailing / -- if you tried to test https://6zjgfa5z5zh4ndlhyz12345678.appsync-api.cn-northwest-1.amazonaws.com.cn/graphql/ it would fail and generate wss://6zjgfa5z5zh4ndlhyz12345678.appsync-api.cn-northwest-1.amazonaws.com.cn/graphql//realtime

Thanks for the reply. Yes I did find the trailing / in my endpoint and after removing it, it works now.

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.