File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { api } from "encore.dev/api" ;
2
+ import log from "encore.dev/log" ;
2
3
import { ApolloServer , HeaderMap } from "@apollo/server" ;
3
4
import { readFileSync } from "node:fs" ;
4
5
import resolvers from "./resolvers" ;
@@ -25,12 +26,20 @@ export const graphqlAPI = api.raw(
25
26
}
26
27
}
27
28
29
+ let body : unknown ;
30
+
31
+ try {
32
+ body = await json ( req ) ;
33
+ } catch ( error ) {
34
+ log . error ( error ) ;
35
+ }
36
+
28
37
// More on how to use executeHTTPGraphQLRequest: https://www.apollographql.com/docs/apollo-server/integrations/building-integrations/
29
38
const httpGraphQLResponse = await server . executeHTTPGraphQLRequest ( {
30
39
httpGraphQLRequest : {
31
40
headers,
32
41
method : req . method ! . toUpperCase ( ) ,
33
- body : await json ( req ) ,
42
+ body,
34
43
search : new URLSearchParams ( req . url ?? "" ) . toString ( ) ,
35
44
} ,
36
45
context : async ( ) => {
You can’t perform that action at this time.
0 commit comments