File tree Expand file tree Collapse file tree 1 file changed +29
-27
lines changed
packages/aws-appsync-subscription-link/src Expand file tree Collapse file tree 1 file changed +29
-27
lines changed Original file line number Diff line number Diff line change @@ -259,37 +259,39 @@ export class AppSyncRealTimeSubscriptionHandshakeLink extends ApolloLink {
259259 // Preparing payload for subscription message
260260
261261 const dataString = JSON . stringify ( data ) ;
262- const headerObj = {
263- ...( await this . _awsRealTimeHeaderBasedAuth ( {
264- apiKey,
265- appSyncGraphqlEndpoint,
266- authenticationType,
267- payload : dataString ,
268- canonicalUri : "" ,
269- region,
270- credentials,
271- token,
272- graphql_headers
273- } ) ) ,
274- [ USER_AGENT_HEADER ] : USER_AGENT
275- } ;
262+ let stringToAWSRealTime : string ;
276263
277- const subscriptionMessage = {
278- id : subscriptionId ,
279- payload : {
280- data : dataString ,
281- extensions : {
282- authorization : {
283- ...headerObj
264+ try {
265+ const headerObj = {
266+ ...( await this . _awsRealTimeHeaderBasedAuth ( {
267+ apiKey,
268+ appSyncGraphqlEndpoint,
269+ authenticationType,
270+ payload : dataString ,
271+ canonicalUri : "" ,
272+ region,
273+ credentials,
274+ token,
275+ graphql_headers
276+ } ) ) ,
277+ [ USER_AGENT_HEADER ] : USER_AGENT
278+ } ;
279+
280+ const subscriptionMessage = {
281+ id : subscriptionId ,
282+ payload : {
283+ data : dataString ,
284+ extensions : {
285+ authorization : {
286+ ...headerObj
287+ }
284288 }
285- }
286- } ,
287- type : MESSAGE_TYPES . GQL_START
288- } ;
289+ } ,
290+ type : MESSAGE_TYPES . GQL_START
291+ } ;
289292
290- const stringToAWSRealTime = JSON . stringify ( subscriptionMessage ) ;
293+ stringToAWSRealTime = JSON . stringify ( subscriptionMessage ) ;
291294
292- try {
293295 await this . _initializeWebSocketConnection ( {
294296 apiKey,
295297 appSyncGraphqlEndpoint,
You can’t perform that action at this time.
0 commit comments