Skip to content

Commit

Permalink
fix(pubsub): AppSync in China regions (#10087)
Browse files Browse the repository at this point in the history
* fix(pubsub): AppSync in China regions 
* fix: Add cn test for appsync support change

Co-authored-by: Ivan Artemiev <29709626+iartemiev@users.noreply.github.com>
Co-authored-by: Aaron S <94858815+stocaaro@users.noreply.github.com>
  • Loading branch information
3 people committed Dec 8, 2022
1 parent fc4940b commit 4725b5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/pubsub/__tests__/AWSAppSyncRealTimeProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ describe('AWSAppSyncRealTimeProvider', () => {
);
expect(result).toBe(false);
});

test('Non-custom domain in the amazonaws.com.cn subdomain space returns `false`', () => {
const provider = new AWSAppSyncRealTimeProvider();
const result = (provider as any).isCustomDomain(
'https://12345678901234567890123456.appsync-api.cn-north-1.amazonaws.com.cn/graphql'
);
expect(result).toBe(false);
});
});

describe('newClient()', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export type ObserverQuery = {
};

const standardDomainPattern =
/^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
/^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com(?:\.cn)?\/graphql$/i;

const customDomainPath = '/realtime';

Expand Down

0 comments on commit 4725b5f

Please sign in to comment.