So I’m currently trying to set up an instance, and I’m unable to upload pictures. The following toaster appears: https://imgur.com/d0MUhUb
And in the logs I see this:
2023-06-25T10:48:11.127198782Z 2023-06-25T10:48:11.127080Z WARN lemmy_server::root_span_builder: Request error: error sending request for url (http://localhost:8080/image): error trying to connect: tcp connect error: Address not available (os error 99)
2023-06-25T10:48:11.127262799Z Reqwest(reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(8080), path: "/image", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 99, kind: AddrNotAvailable, message: "Address not available" })) })
I have a pictrs container up, and set the following options in lemmy.hjson:
pictrs_config: {
url: "http://pictrs:8080"
api_key: "apikey"
}
Also tried it with pictrs_url: "http://pictrs:8080"
(as described here), but that didn’t help either.
Why is lemmy trying to access localhost:8080 rather than pictrs:8080?
Edit: This has been resolved, thanks to @slashzero@hackbox.social: https://lemmy.ml/comment/948928
Well, butter my butt and call me a biscuit. In implementing this, I stumbled upon an issue: I had the url in
pictrs_config
, when it should have beenpictrs
.Now at least the logs are showing an error that matches the toaster: ``` 2023-06-25T13:09:27.753749368Z 2023-06-25T13:09:27.753609Z WARN lemmy_server::root_span_builder: error decoding response body: expected value at line 1 column 1 2023-06-25T13:09:27.753809022Z reqwest::Error { kind: Decode, source: Error(“expected value”, line: 1, column: 1) }
I already have those containers in an external network, and changing the URL hasn't fixed it.
One other thing I did was update my resolve.conf so that valid DNS IPs were making it to the containers. Otherwise the containers might not have valid DNS. Also try rebooting your host.
Here is what I did to fix the container DNS lookups failing:
https://stackoverflow.com/questions/20430371/my-docker-container-has-no-internet
Yeah no, DNS works in the containers:
dot@deepthought:~# docker exec -it lemmy-lemmy-1 ping pictrs PING pictrs (192.168.7.2): 56 data bytes 64 bytes from 192.168.7.2: seq=0 ttl=64 time=0.079 ms
However, your hunch did actually turn out to be correct in that there’s still a networking issue: I opened a port for pictrs and hit the API with postman, and noticed it would show up in the pictrs logs which were empty before. So I changed the
url
to the host’s IP and the open port, and now it works. :)lemmy.hjson:
pictrs: { url: "http://192.168.123.21:4808" api_key: "apikey" }
docker-compose.yaml:
pictrs: ... ports: - "4808:8080"
Oh, good idea! Whatever works for you. I spent several hours yesterday trying all sorts of networking hacks to resolve the issue on my instance. I eventually found a combination that worked for me.
The concern here is we are all solving this issue in slightly different ways on our self hosted instances. Eventually, I hope the lemmy dev team releases 0.18.1 fixing all these issues for good.
Oh, this span builder error. Yeah I’ve been seeing that error since I upgraded to 0.18.0. Sorry, I don’t have a solution for this one.
Glad you figured out your pictrs error though! One other thing I did was update my resolve.conf so that valid DNS hosts were making it to the containers. Also try rebooting your host.
Feel free to add to this discussion. https://github.com/LemmyNet/lemmy/issues/3314