Originally posted on DevTo
For a while I have my own Kubernetes stack on DigitalOcean where I can do some science and host what I want or what others ask me like blogs, landing pages, cron-jobs and of course a Gitea instance. One day I decided to fire up a Drone.io instance so I can automate the boring tasks with it. It was like Drone 1.0 or something. Everything worked as I expected and I was happy. One day I updated Gitea and suddenly Drone stopped working. No problem, updated Drone too and that’s where all the fun part started.
I always got an error message:
invalid character '<' looking for beginning of value
I tried to find a reasonable answer, but found nothing. I knew from that error message it’s definitely coming from a JSON parser that received HTML instead. I met this error message a lot of times before, but I did not know why it happens. Drone->Gitea connection should be fine because the OAuth login works and the Webhook calls back to Drone when push happened.
I decided to sit back and who cares, those jobs are running like monthly once
and there is already a Makefile
in there that does the same. So for like 3-4
months I built/published them manually. Not a bit deal, like extra 5-10
minutes, but still… It’s not working and it’s poking brain hard, WHY? But I
had no time for that. Deeply, I had a light hope it’s not something I fix but
they have to fix it.
But now, I had time for that. Updated Gitea and Drone. Kick off a build… It’s still the same error. And that was the point where I said “No I can’t get away with this, I will find and fix it” and I did ;)
That’s the reason why I write this, maybe someone else has the same problem and has no idea why it does not work. After I decided to recreate the whole Drone stack based on the documentation… it has the same error again. I went to sleep. A woke up from a serious nightmare where a whale with a tattoo tried to catch me. The tattoo was (obviously, thanks brain) “invalid character ‘<’ looking for beginning of value”. And I was not able to sleep back.
Solution? Is there a solution? Or is it an infinite pain I have to live with?
Yes, there is a solution. I don’t really know how I ended up changing the value
for DRONE_GITEA_SERVER
but I did. And suddenly everything worked. Here is a
diff that made me crazy:
- DRONE_GITEA_SERVER=https://gitea.domain.com/
+ DRONE_GITEA_SERVER=https://gitea.domain.com
Yes, I just removed (to be more precise, I missed it during the copy-paste) and that’s it. That was the solution. With the trailing slash was fine for the OAuth redirect, but for git clone it was an error.
If you came here because you have the same problem. I hope it helps you and you don’t have to wake up because a giant whale chases you.