mirumee / saleor-app-framework-python

Python Saleor App/Extension boilerplate. Batteries included.
https://mirumee.github.io/saleor-app-framework-python/
BSD 3-Clause "New" or "Revised" License
50 stars 23 forks source link

simple_app - localhost:5000 returns 404 {"detail":"Not Found"} #25

Open kmocorro opened 2 years ago

kmocorro commented 2 years ago

Hi Saleor Team,

I managed to add appUrl in the manifest so python3 -m simple_app would work. The problem next is the server returns 404. Anything I could have missed? Thanks!

image
peteror commented 2 years ago

Hi, I just started with this one yesterday, the endpoint you are looking for is at localhost:5000/webhook

kmocorro commented 2 years ago

Hello @peteror ,

Somehow, it returns method not allowed.

image
peteror commented 2 years ago

this framework sets the /webhook endpoint for receiving Saleor callbacks, which are POST messages. If you just use it from a browser, it will send GET, which is not defined, thus you get this message.

kmocorro commented 2 years ago

Yea, I did POST request using postman. I got different response.. Now, I have to look for the header x-saleor-event which in case, I don't know yet what's the value.

peteror commented 2 years ago

The x-saleor-event is one of the events you see here: https://docs.saleor.io/docs/3.0/developer/api-reference/enums/webhook-sample-event-type-enum/. Then you'll also need x-saleor-domain (which is where your Saleor API is) then you'll need x-saleor-signature which is calculated by Saleor: you can either try to hack this framework and remove this validation or just use a local Saleor instance to test it with.

peteror commented 2 years ago

one more thing: if you run Saleor-platform (or Saleor in any other way) locally in Docker, use this as the webhook target (assuming this Python app also runs on your machine): host.docker.internal:port (where the port you run this Python app on)