awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
919 stars 266 forks source link

I am not able to get App sync custom header for subscription requests from UI app #630

Open sumancholleti opened 3 years ago

sumancholleti commented 3 years ago

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Do you want to request a feature or report a bug? Bug

What is the current behavior? Custom headers are not being forwared to my lambda which is configured as a resolver for subscription requests

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. I used the code below and when I checked my lambda from context its not showing this custom header and I ensured this is whitlisted in cloudfront as well const appsyncClient = new AWSAppSyncClient(AppSyncConfig, { defaultOptions: { query: { fetchPolicy: 'network-only', errorPolicy: 'all', }, }, link: createAppSyncLink({ ...AppSyncConfig, resultsFetcherLink: ApolloLink.from([ setContext((request, previousContext) => ({ headers: { ...previousContext.headers, 'my-custom-header':'123456' }, })), createHttpLink({ uri: AppSyncConfig.url, }), ]), }), });

What is the expected behavior? Custom header should be available in lambda Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?

"aws-appsync": "4.0.3", import { setContext } from "apollo-link-context"; 1.0.8 import { ApolloLink } from "apollo-link"; 1.2.2 import { createHttpLink } from "apollo-link-http"; 1.5.4

bpcrao commented 3 years ago

I too am facing the same issue, any updates here ?

langerkirill commented 2 years ago

Same issue here. The base64 encoded version of my headers do not have the custom headers I entered for subscription linking.