dialogflow / dialogflow-nodejs-client

Node.js SDK for Dialogflow
Apache License 2.0
658 stars 287 forks source link

(With solution ->) Request header field api-request-source is not allowed by Access-Control-Allow-Headers #70

Open protyze opened 7 years ago

protyze commented 7 years ago

Hi there,

The API seems to block requests with the following message: "Request header field api-request-source is not allowed by Access-Control-Allow-Headers"

I saw that in the code here: https://github.com/api-ai/apiai-nodejs-client/blob/master/module/request.js on line 55 where the header is set up, the api-request-source header is added: 'api-request-source': self.requestSource

but in the documentation here: https://api.ai/docs/reference/agent/query#post_query

That header isn't there. After removing it from the code of the Node.js SDK, the request worked perfectly.

Should this be removed?

Best, Jan

arjun-coursera commented 7 years ago

Agreed. I had the exact same issue and fixed by removing api-request-source on request.js as mentioned in the above post.

samsherwood commented 7 years ago

Just noting that this issue is still open and still affects the Node.js SDK. It's incredibly annoying, as production builds must be edited constantly to accommodate this issue.

Matrixzen commented 7 years ago

Is there a fix in the near future?

On Oct 13, 2017, at 1:43 PM, Sam Sherwood notifications@github.com<mailto:notifications@github.com> wrote:

Just noting that this issue is still open and still affects the Node.js SDK. It's incredibly annoying, as production builds must be edited constantly to accommodate this issue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/dialogflow/dialogflow-nodejs-client/issues/70#issuecomment-336562478, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZcNUNWrmji5cql_3cvGBUTh9du-SlZMks5sr8uHgaJpZM4OLAnT.