0
我在我的Angualar应用程序中使用Apollo,现在正在处理此问题。我在AWS Lambda上有一个GraphQL端点,并且通过API网关,我看到响应正确回来,但是当它读完它时,它会引发此错误。 AWS使用LAMBDA_PROXY意外的输入结束:从API API网关获取响应时发生ApolloClient错误
//setup
const client = new ApolloClient({
networkInterface: createNetworkInterface({
opts: {
mode: 'no-cors',
},
uri: "https://xxxxxxx.execute-api.ap-southeast-2.amazonaws.com/dev/graphql"
}),
});
//make the call
this.apollo.watchQuery({
forceFetch: true,
query: QueryToSend
}).subscribe(({data}) => {
...process...
}, error => {
console.log(error);
});
//the error...
Network error: Unexpected end of input
at new ApolloError (ApolloError.js:31)
at QueryManager.js:128
at t.invoke (polyfills.js:3)
at Object.onInvoke (ng_zone.js:236)
at t.invoke (polyfills.js:3)
at e.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (ng_zone.js:227)
at t.invokeTask (polyfills.js:3)
请求是
const QueryToSend= gql`
query data {
getSuperDefinitionList{
id,
name,
}
}
`;
不知道什么是错的。我从Postman和SoapUI调用相同的请求体。我甚至看到提琴手响应具有正确的响应...
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: ...
Connection: keep-alive
Date: Fri, 13 Jan 2017 21:10:10 GMT
x-amzn-RequestId: ab0fghjghja-d9d4-11e6-b19a-090dsfvdgcebe
X-Amzn-Trace-Id: Root=1-58794232-c7f7157d28e033330dbbe6f2
X-Cache: Miss from cloudfront
Via: 1.1 a1d4b598e9b2fghjgfhj3991961a666a6.cloudfront.net (CloudFront)
X-Amz-Cf-Id: XHeOfghjfghjUthDPKxVbCrFoLM4iOYpf9X9mWlu2Z374grmuAv5jMjg==
{"data":{"getSuperDefinitionList":[{"id":"83d3b09f-a947-4a33-bcb0-f5c9e0446ace","name":"S","__typename":"SuperDefinitionType"}]}}
所有看起来不错,从AWS但阿波罗或一些JavaScript库,它使用没有。
我该怎么办?