clean-breakfast-29827
10/07/2020, 5:19 PMimport * 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....