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
Twitter DMs and Mentions do not arrive #2460
Comments
Hi @raphaelm Is there any hint in log/production.log (e. g. -i twitter) ? |
That's the output of
|
I see a verify call from twitter to verify your web hook. But I see no http calls from twitter to your webhook. -=> It seems twitter is not sending messages to your webhook. You have a https host, right? Maybe something wrong which your ssl cert? Any other errors in log/production.log which is related to twitter? |
We run into the same problem on our instance, running the current release. |
Same here, I've found something that could help ?
|
Mmm, is this linked to https://community.zammad.org/t/dont-receive-twitter-dms-railsserver-error/1799/26 ? |
@nicolaswurtz This is related to the community issue, we still haven't found the cause yet, it would be great if we could keep the discussion regarding this off this tracker. :-) @raphaelm Please give Feedback to Martin, especially about the SSL question. @rixx Exact same problem as @raphaelm ? Please provide logfiles. |
Yes.
Not that I can think of: https://www.ssllabs.com/ssltest/analyze.html?d=support.rami.io&latest
I can't find any. Does Twitter provide any tool to debug webhooks? I couldn't find anything. |
I think this is really the same issue — @raphaelm could you add
|
Nope, not the same issue. "No such channel for user" doesn't appear in the log and I already checked that the user IDs match |
Okay, so we might have two different issues here @martini |
Small update on the issue. The post can be found here: https://community.zammad.org/t/dont-receive-twitter-dms-railsserver-error/1799/34 |
Any updates or fixes in the meantime? |
Hey @schiederme - unfortunately no updates yet. As @MrGeneration described earlier there has been some research in the community indicating that the stored ID might be wrong. I wrote a little script to compare the stored ID with the ID we receive from the Twitter API for each Twitter channel. It will also print out the ID so you can/should verify that this is the actual ID of your account. Feedback welcome! Channel.where(area: 'Twitter::Account').each do |channel|
client = Twitter::REST::Client.new do |config|
config.consumer_key = channel.options['auth']['consumer_key']
config.consumer_secret = channel.options['auth']['consumer_secret']
config.access_token = channel.options['auth']['oauth_token']
config.access_token_secret = channel.options['auth']['oauth_token_secret']
end
if channel.options['user']['id'] != client.user.id
puts "ATTENTION: Found ID mismatch. Local ID '#{channel.options['user']['id']}' doesn't match with received remote ID '#{client.user.id}'."
else
puts "Local ID '#{channel.options['user']['id']}' matches with received remote ID. Please double check if this is the ID of your twitter account (via e.g. https://tweeterid.com)."
end
end Output looks like this: You can execute it by creating a file called |
I tried the script with my account (@level66network at Twitter) and my Zammad installation, too, and it looks like the IDs do actually mismatch in the installation.
In my logs i also find the following issue triggered by the webhook.
|
Wow! This is really it! We found out that the ID is properly send from the backend (Ruby) to the frontend (JavaScript) which then breaks the number because it can't handle this large integers properly, as "abelxluck" found out here. So the error occurs once you open a Twitter channel to edit it and save your changes afterwards. After this point you won't be able to receive Twitter direct messages. You can fix your broken channels by running the command: Channel.where(area: 'Twitter::Account').each do |channel|
client = Twitter::REST::Client.new do |config|
config.consumer_key = channel.options['auth']['consumer_key']
config.consumer_secret = channel.options['auth']['consumer_secret']
config.access_token = channel.options['auth']['oauth_token']
config.access_token_secret = channel.options['auth']['oauth_token_secret']
end
channel.options['user']['id'] = client.user.id
channel.save!
end Via the Zammad rails console. However, this will only work until you go and save/edit your Twitter channel via the admin interface again. We're working on a sustainable solution for this. @rlue - can you please take over from here? We need to convert the ID to a string and store it that way. My hot fix script could be the starting point for the required migration. Besides from that we need to change the code that initially fetches and stores the ID as an integer. Additionally we need to find the other places that use the ID and make sure they handle the string version properly. |
I forgot to mention: Thanks a ton @MrXermon for jumping in that fast! Your input and the one of abelxluck helped me to find the root cause in the Zammad context. Fix is on the way 🚂 |
Thank you @thorsteneckel, the work around works! |
Thank you @thorsteneckel for creating the workaround! It works with my system, too! <3 |
@thorsteneckel, is it safe to assume that $ grep "\['user'\]\['id'\]" should find all the instances we're looking for? |
I'd suggest to dig for |
…age functionality In some cases, editing a Twitter account via the admin panel would cause new DMs to stop coming in. Why? All Twitter usernames correspond to a numeric user ID (see https://tweeterid.com/). Zammad stores this ID on Twitter channels (under `channel.options['user']['id']`) and uses it to monitor incoming DMs. Zammad was storing these user IDs to the DB as integers, then passing those values to the frontend (JS) for account editing. Some user IDs are longer than JavaScript's `Number.MAX_SAFE_INTEGER`, and so got truncated on their way back to the update endpoint (e.g., 984608854112718800 instead of 984608854112718848). This commit enforces string storage of Twitter user IDs on new channels, and includes a migration to verify and stringify IDs on existing ones. Zammad Community: https://community.zammad.org/t/1799/34 GitHub: #2460
Fixed with the commit above. Will be released with Zammad 3.2 which will arrive soon (1-2 weeks). |
Hi,
we set up Twitter integration according to the documentation ant the Channel settings do not show any errors. However, nothing arrives.
Infos:
Expected behavior:
Actual behavior:
Yes I'm sure this is a bug and no feature request or a general question.
Can you help us to find out what info you need for debugging?
The text was updated successfully, but these errors were encountered: