Can't Connect API Gateway to Appsync GraphQL Endpoint - 500 Errors


I'm Trying to make an API Gateway path that will proxy to my Appsync GraphQL API. This is so that users can access it at our normal domain instead of the subdomain Appsync gives us. All settings appear to be correct but it's throwing 500 errors when I attempt to use it and there are no logs in API Gateway or Appsync that explain why it's throwing 500 errors. Appsync works fine when calling it directly via the given subdomain. API Gateway also works fine for the other endpoints. I'm using CDK to setup all services. My setup code is below:

const api = new RestApi(this, 'poolsApi', {
      restApiName: 'Pools Service',
      deployOptions: {
        accessLogDestination: new LogGroupLogDestination(apiGatewayLogGroup),
        accessLogFormat: AccessLogFormat.jsonWithStandardFields({
          caller: false,
          httpMethod: true,
          ip: false,
          protocol: true,
          requestTime: true,
          resourcePath: true,
          responseLength: true,
          status: true,
          user: false
        cachingEnabled: true,
        cacheClusterEnabled: true

const graphqlApi = new GraphqlApi(this, 'Api', {
      name: 'poolsApi',
      schema: Schema.fromAsset(join(__dirname, 'appsync/pools/schema.graphql')),
      authorizationConfig: {
        defaultAuthorization: {
          authorizationType: AuthorizationType.API_KEY,
          apiKeyConfig: {
            name: 'BalancerAPIKey',
            expires: Expiration.atTimestamp(BALANCER_API_KEY_EXPIRATION),
      xrayEnabled: true,

const graphQLApiEndpoint = api.root.addResource('graphql');
graphQLApiEndpoint.addMethod('POST', new AwsIntegration({
      service: 'appsync-api',
      region: this.region,
      subdomain: graphqlApi.apiId,
      integrationHttpMethod: 'POST',
      path: 'graphql',
      options: {
        passthroughBehavior: PassthroughBehavior.WHEN_NO_TEMPLATES,
        credentialsRole: appSyncAccessRole,
        integrationResponses: [{
          statusCode: '200'
        requestParameters: {
          'integration.request.header.x-api-key': `'${graphqlApi.apiKey}'`
    }), {  
      methodResponses: [{
        statusCode: '200',
        responseModels: {
          'application/json': Model.EMPTY_MODEL

export function addCorsOptions(apiResource: IResource) {
    new MockIntegration({
      integrationResponses: [
          statusCode: '200',
          responseParameters: {
            'method.response.header.Access-Control-Allow-Origin': "'*'",
      passthroughBehavior: PassthroughBehavior.NEVER,
      requestTemplates: {
        'application/json': '{"statusCode": 200}',
      methodResponses: [
          statusCode: '200',
          responseParameters: {
            'method.response.header.Access-Control-Allow-Headers': true,
            'method.response.header.Access-Control-Allow-Methods': true,
            'method.response.header.Access-Control-Allow-Credentials': true,
            'method.response.header.Access-Control-Allow-Origin': true,
1 Answer

I couldn't get the AwsIntegration working and switched to a HttpIntegration instead. There are no docs explaining the AwsIntegration and how it works anywhere on AWS...

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions