Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix Integration does not work #2822

Open
APT37 opened this issue Aug 25, 2024 · 8 comments
Open

Matrix Integration does not work #2822

APT37 opened this issue Aug 25, 2024 · 8 comments

Comments

@APT37
Copy link

APT37 commented Aug 25, 2024

Hi, I've tried to set up the Matrix Integration, but Miniflux never sends any messages to my Matrix server.

Everything is set up according to the documentation, I also tried different room and user settings.

There are no outgoing requests shown in the -debug log either, nor do the NginX logs show any incoming requests.

@bfahrenfort
Copy link

Reproducing on latest docker. No logs suggest an issue. I went into the "bot" account (this should really use an AppService in future) manually and saw that it did sign into the account, but it hadn't even joined the channel. I had it join the channel while I was still logged in but no change.

@fguillot
Copy link
Member

fguillot commented Sep 7, 2024

This is working for me. I just tested with https://element.io/ and https://matrix.org.

In the Miniflux logs, you should see a message like this one when new entries are created:

time=2024-09-07T15:41:27.336-07:00 level=DEBUG msg="Sending new entries to Matrix" user_id=1 nb_entries=3 feed_id=33

If that doesn't work, you should see an error with the message "Unable to send new entries to Matrix".

If you don't see anything in the logs, then it's most likely a misconfiguration in the integration settings. Note that only new entries are sent to Matrix during feed refreshes.

@APT37
Copy link
Author

APT37 commented Sep 9, 2024

I'm not using an integration manager service, since my server is not federated.

This is likely the root cause, but since there are no corresponding error messages from Miniflux, I can't tell for sure. It would be helpful if Miniflux was more verbose here.

I did not see anything like the example messages you provided.

@bfahrenfort
Copy link

bfahrenfort commented Sep 9, 2024

I'm not using an integration manager service, since my server is not federated.

This is likely the root cause, but since there are no corresponding error messages from Miniflux, I can't tell for sure. It would be helpful if Miniflux was more verbose here.

I did not see anything like the example messages you provided.

I just got notifs from Matrix! I don't think Miniflux is properly using the .well-known file. I had to both log in as the bot manually to make it join the channel and then set "matrix server URL" to the protocol link (ie, https://matrix.mydomain,com).

image

@APT37
Copy link
Author

APT37 commented Sep 9, 2024

I've also manually joined the channel as the bot and set everything up as shown in your example, but nothing changed. I use the root of the domain btw, not a subdomain. Reverse proxies are great. 💯

I don't think Miniflux uses the well-known file at all, but to be sure, we'd have to check the source of course.

@fguillot
Copy link
Member

fguillot commented Sep 9, 2024

The code is very easy to read. It's only 2 files:

Let me know if something is missing in the discovery process:

// Specs: https://spec.matrix.org/v1.8/client-server-api/#getwell-knownmatrixclient
func (c *Client) DiscoverEndpoints() (*DiscoveryEndpointResponse, error) {
endpointURL, err := url.JoinPath(c.matrixBaseURL, "/.well-known/matrix/client")
if err != nil {
return nil, fmt.Errorf("matrix: unable to join base URL and path: %w", err)
}
request, err := http.NewRequest(http.MethodGet, endpointURL, nil)
if err != nil {
return nil, fmt.Errorf("matrix: unable to create request: %v", err)
}
request.Header.Set("Accept", "application/json")
request.Header.Set("User-Agent", "Miniflux/"+version.Version)
httpClient := &http.Client{Timeout: defaultClientTimeout}
response, err := httpClient.Do(request)
if err != nil {
return nil, fmt.Errorf("matrix: unable to send request: %v", err)
}
defer response.Body.Close()
if response.StatusCode >= 400 {
return nil, fmt.Errorf("matrix: unexpected response from %s status code is %d", endpointURL, response.StatusCode)
}
var discoveryEndpointResponse DiscoveryEndpointResponse
if err := json.NewDecoder(response.Body).Decode(&discoveryEndpointResponse); err != nil {
return nil, fmt.Errorf("matrix: unable to decode discovery response: %w", err)
}
return &discoveryEndpointResponse, nil
}

@bfahrenfort
Copy link

bfahrenfort commented Sep 9, 2024

I've also manually joined the channel as the bot and set everything up as shown in your example, but nothing changed. I use the root of the domain btw, not a subdomain. Reverse proxies are great. 💯

I don't think Miniflux uses the well-known file at all, but to be sure, we'd have to check the source of course.

Are you certain that you use the root domain for the matrix protocol? If you use a well-known file, that's using the root domain to redirect to a different domain (for me, it's the matrix subdomain, which is why that matrix server address works for me).

For example, my well-known file on my root redirects to the matrix subdomain.

@APT37
Copy link
Author

APT37 commented Sep 9, 2024

Unfortunately I do not know Go very well - but I'm not familiar with the details of discovery and authentication processes anyway. My approaches to solving this issue were rather high-level, I'm afraid.

Are you certain that you use the root domain for the matrix protocol?

Yes indeed, but some clients still needed the .well-known file iirc. I set the server up quite a while ago...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants