Method GET not allowed for URL /webhooks/rest/webhook

When trying to connect the ui with the rasa server, by making a post request with ajax i get the folowing error:

File “/build/lib/python3.6/site-packages/sanic/app.py”, line 920, in handle_request handler, args, kwargs, uri = self.router.get(request) File “/build/lib/python3.6/site-packages/sanic/router.py”, line 407, in get return self._get(request.path, request.method, “”) File “/build/lib/python3.6/site-packages/sanic/router.py”, line 447, in _get raise method_not_supported sanic.exceptions.MethodNotSupported: Method GET not allowed for URL /webhooks/rest/webhook

what you say “the UI”, which UI do you mean ? is it a website with a chat widget? Looking at the error, it seems the server is receiving a GET request instead of a POST. What does your javascript code look like ?

I mean a basic html script with js code embedded and an ajax call to communicate with the rasa server api. Although the error says “Method GET not allowed” the ajax call request has type “POST” (see below)

$.ajax({
			url: 'http://XXXXXX.appspot.com/webhooks/rest/webhook', //  RASA API
			type: 'POST',
			headers: {
				'Content-Type': 'application/json'
			},
			data: JSON.stringify({
				"sender": "user",
				"message": text
			}),
			dataType: "jsonp",
			crossDomain: true, 
                    ....

Also except the “Method” error I can see in Google App engine logs also the folowing error:

Exception occurred while handling uri: ‘http://XXXXXX.appspot.com/webhooks/rest/webhook?callback=jQuery20307649411001250048_1573033488328&{“sender”:“user”,“message”:“hi”}&_=1573033488329

do you get the same error if you send this request via curl instead?

This error was caused because I implemented an ajax call with dataType:“jsonp” and as I searched on the web; it changes the type from “POST” to “GET”. I changed the datatype to “json” and now I have a “POST” request, but with the CORS error. My Dockerfile is:

FROM rasa/rasa
ENV BOT_ENV=production
COPY . /var/www
WORKDIR /var/www
RUN rasa --version
RUN python --version
ENTRYPOINT [ "rasa", "run","--debug","--p","8080","--enable-api","--cors","\"*\""]

As you can see I have enable the Allow Origin argument (–cors) for all urls, but still I can’t avoid the CORS problem. Is there any way to check that --cors “*” argument is working properly on the latest version of rasa?

P.S. As I know Curl and Postman do not take into account CORS and so they work properly with my rasa server.

P.S.2 Slack is working properly

Hi @amn41 @Iamhuntingwabbits I am new to this. pls help I ran this command in my rasa project directory “rasa run -m models --enable-api --cors “*” --debug” and tried to open the URL http://localhost:5005/webhooks/rest/webhook Getting the attached error. Kindly please help.

hi @iampkk, you are getting this error because loading a URL in the browser is like doing a GET request. You want to send a POST request (e.g. sendign data) check out HTTP Methods for RESTful Services and maybe try a tool like https://www.getpostman.com/

Did you find the solution for this? I know it’s been a while, but I m stuck here

@Iamhuntingwabbits Same issue when using chatroom UI with rasa. Please guide me

SAME ISSUE ANY SOLUTION HELPS A LOT

I am facing the issue like, getting no reply from the Rasa.

I deployed rasa into heroku server. At the time of request for reply I got no reply from the server. which log and reply is attached below.

I also tested on the local host for testing purpose. to know whether it is working fine or not , but got the error. which I am attaching the screenshot of it below.

Help will be appreciated. Thnx in advace .