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

Resource not found when calling Zenpy.chats.triggers() #625

Closed
LucasCiocari opened this issue Apr 3, 2024 · 5 comments
Closed

Resource not found when calling Zenpy.chats.triggers() #625

LucasCiocari opened this issue Apr 3, 2024 · 5 comments
Assignees

Comments

@LucasCiocari
Copy link

When upgrading to zenpy 2.0.35 from 2.0.25 it was noticed that the Zenpy.chats.triggers() method was now returning an exception:

APIException: {"error": "ResourceNotFound", "description": "The requested resource could not be located or does not exist"}

During exploration of the library to find the issue, it was noticed that the call
Zenpy( ... ).chats.triggers._get(insp._build_url(endpoint=insp.endpoint())) returned the results just fine.

When setting log level to debug, it seems that the call being made on Zenpy().chats.triggers() is hitting the endpoint

https://www.zopim.com/api/v2/triggers/True instead of https://www.zopim.com/api/v2/triggers

Zenpy().chats.triggers() debug result:

2024-04-03 09:37:37,723 - zenpy.lib.api - DEBUG - GET: https://www.zopim.com/api/v2/triggers/True - {'timeout': 60.0}
2024-04-03 09:37:38,971 - urllib3.connectionpool - DEBUG - [https://www.zopim.com:443](https://www.zopim.com/) "GET /api/v2/triggers/True HTTP/1.1" 404 None
2024-04-03 09:37:38,973 - zenpy.lib.api - DEBUG - Received response code [404] - headers:

while

Zenpy( ... ).chats.triggers._get(insp._build_url(endpoint=insp.endpoint()))

returns

2024-04-03 09:35:03,272 - zenpy.lib.api - DEBUG - GET: https://www.zopim.com/api/v2/triggers - {'timeout': 60.0}
2024-04-03 09:35:04,452 - urllib3.connectionpool - DEBUG - [https://www.zopim.com:443](https://www.zopim.com/) "GET /api/v2/triggers HTTP/1.1" 200 None
2024-04-03 09:35:04,456 - zenpy.lib.api - DEBUG - TriggerResponseHandler matched:

I believe this change might have something to do with it:

https://github.com/facetoe/zenpy/compare/2.0.25...2.0.35?diff=unified&w=#diff-85faba355a00935e5032c0aae05af1c9c73049fb720c1f7dba33c0454da6160cR202

These tests were done with version 2.0.45 but confirmed that in version 2.0.47 the error still occurs.

@cryptomail
Copy link
Collaborator

Sorry it's taken me so long to get look at this. Thank you for your investigation. I'll triage this further and see if I can remediate it with/for you.

@cryptomail cryptomail self-assigned this Apr 10, 2024
@cryptomail
Copy link
Collaborator

cryptomail commented Apr 28, 2024

I've found the source of the bug. It's around here:

and kwargs['cursor_pagination'] is not None):

I'm going to try to figure out what the most "correct" course of action is.

@cryptomail
Copy link
Collaborator

@LucasCiocari Do you think you could try to consume #626 and test?
please install this branch locally and give it a try :)

@LucasCiocari
Copy link
Author

@LucasCiocari Do you think you could try to consume #626 and test? please install this branch locally and give it a try :)

Worked perfectly!

@cryptomail
Copy link
Collaborator

OK I'll schedule some time to merge and then bump.

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

No branches or pull requests

2 participants