Heya, not sure where to ask this question, so I'll...
# aws
c
Heya, not sure where to ask this question, so I'll just start here. trying to setup an API stack with Pulumi, awsx gateway, Apollo graph server and neo4j... I can get through the apollo server with some typeDefs and resolvers
Copy code
import * as awsx from '@pulumi/awsx'
import { lambda } from '@pulumi/aws'
import {
  APIGatewayProxyEvent,
  Callback,
  APIGatewayProxyResult,
} from 'aws-lambda'

import { ApolloServer, gql } from 'apollo-server-lambda'

const AwsLambdaContextForPulumiContext = (
  pulumiContext: lambda.Context
): AWSLambda.Context => {
  const lambdaContext: AWSLambda.Context = {
    done() {
      throw new Error('done is just a placeholder ')
    },
    fail() {
      throw new Error('fail is just a placeholder ')
    },
    succeed() {
      throw new Error('succeed is just a placeholder ')
    },
    ...pulumiContext,
    getRemainingTimeInMillis: () =>
      parseInt(pulumiContext.getRemainingTimeInMillis(), 10),
    memoryLimitInMB: pulumiContext.memoryLimitInMB,
  }
  return lambdaContext
}

const endpoint = new awsx.apigateway.API('hello', {
  routes: [
    {
      path: '/',
      method: 'ANY',
      eventHandler: (
        event: APIGatewayProxyEvent,
        context: lambda.Context,
        callback: CallbackAPIGatewayProxyResult
      ) => {
        const awsContext = AwsLambdaContextForPulumiContext(context)

        const typeDefs = gql`
          type Query {
            hello: String
          }
        `

        const resolvers = {
          Query: {
            hello: () => 'Hello world!',
          },
        }
        const server = new ApolloServer({
          typeDefs,
          resolvers,
          playground: {
            endpoint: '/',
          },
        })

        if (event.httpMethod === 'GET') {
          server.createHandler()(
            { ...event, path: event.requestContext.path || event.path },
            awsContext,
            callback
          )
        } else {
          server.createHandler()(event, awsContext, callback)
        }
      },
    },
  ],
})

// Export the public URL for the HTTP service
exports.endpoint = endpoint.url
but once I attach neo4j driver to a neo4j sandbox all I get back is a timeout error. Wondering if anyone has tried to do this or something similar and can point me towards a resource to debug what is going on here....