I’m new in drone, and have my drone installed this week.
I encountered a strange issue and have no clue to make it right.
After installation everything went well at first.
Drone web server can be access on any links on it, and drone runner executed on every commit.
However, when I try to use it again after couple hrs of use.
I tried two version of drone, and agent. (latest, v1) All comes the same result.
I’m able to recover the server by restarting docker container, but the issue would hanpped again repeatly after couple hours of use.
Please help to figure the issue. Thanks
Here’s my setup:
OS: Linux Mint 19
gitea/gitea:latest
drone/drone:1
drone/agent:1
Drone is able to talk to Gitea API(HTTP) at the first few hrs. The issue does not occur at beginning.
It’s very odd drone became unavailable for some reason.
And drone service could be recovered by restarting drone docker container. (only drone is ok)
I can only tell you what I can see. This is a typical log message if the API is not available as configured by the admin. Generally I would always suggest to use a reverse proxy and proper domain names.
Drone sends incorrect access_token url to Gitea which is unrecognized by Gitea after hrs of serving.
Also Drone send access_token using HTTP GET method which is denied by Gitea sometimes. (should be POST)
/login/oauth/access_token (the correct url and use HTTP POST method)
//login/oauth/access_token (incorrect url with extra slash at the beginning)
normal request
[Macaron] 2019-09-20 05:47:19: Started POST /login/oauth/access_token for 172.17.0.1
[Macaron] 2019-09-20 05:47:19: Completed POST /login/oauth/access_token 200 OK in 79.17641ms
incorrect url request
[Macaron] 2019-09-20 07:04:51: Started POST //login/oauth/access_token for 172.17.0.1
[Macaron] 2019-09-20 07:04:51: Completed POST //login/oauth/access_token 404 Not Found in 1.326638ms
[Macaron] 2019-09-20 07:04:51: Started POST //login/oauth/access_token for 172.17.0.1
[Macaron] 2019-09-20 07:04:51: Completed POST //login/oauth/access_token 404 Not Found in 1.401705ms
incorrect HTTP method used
[Macaron] 2019-09-20 07:08:50: Started GET /login/oauth/access_token for 192.168.31.10
[Macaron] 2019-09-20 07:08:50: Completed GET /login/oauth/access_token 404 Not Found in 1.96634ms
The extra slash sent by drone is definitely a bug.
And unacceptable HTTP GET method may be disabled recently by Gitea dev team.
Thanks @kaijajan, I just ran into this exact issue. Got my Drone setup activated the other day, sat down today to do more with it and got the 404 error. Have you opened a ticket for this on the issue tracker yet?
If the HTTP method is changing, that usually tells me Drone is being supplied with the wrong URL and is being automatically redirected. An auto-redirect changes a POST to a GET when the redirect takes place.
If the wrong URL for Gitea is supplied to Drone, how is it able to initially authenticate? I’ve also noticed that restarting the Docker container fixes the issue temporarily. It seems that sometimes Drone can authenticate and sometimes it cannot, but I only specify the Gitea URL once in my configuration.
I might be getting the requests out of sequence here, but might the extra slash in the request from Drone not lead to a redirect?
I am unable to reproduce any issues. I just set up Drone (latest) and Gitea (1.10.0+dev-318-g730065a3d) and the system is working as expected. I would encourage kaijajan to send a patch if certain this is a bug.
edit: here is the configuration I used when testing
The error does not occur on initial setup. It appears to occur at some future point I am yet to nail down, when Drone checks in with Gitea. I’ve cloned the code repo to have a nose around as soon as I get chance.
since I cannot reproduce, and since this does not appear to be impacting most installations, there is just not enough data for me to conclude there is a bug with drone. If you are able to provide steps to reproduce, I would be happy to investigate further.
There are valid reasons one may receive a 404 (detailed above).
This thread is related to problems refreshing the Gitea oauth2 token due to including a trailing / in the Gitea server address (which can be resolved by removing the trailing slash). When the system cannot refresh the token, the system is no longer authorized to access the repository hence the 404 not found. Gitlab does not use refresh tokens, so any issues with Gitlab would be unrelated to what is being discussed in this thread.