Closed tripzone closed 2 years ago
We're facing the same issue. For us it's caused by cyclic references. So if have 2 pieces of content, A and B. A refers to B either via a reference field or an embed and then B refers to A either through a reference field or inline embed.
I believe limiting recursion depth should solve this issue:
max_include_resolution_depth=5
Unfortunately I got the same error. I also use the include
filter in the query. I figure that would make a difference as well. The content we have setup does have a several references.
Hey @afraazali,
Which version of the SDK are you using? If using master, please update to the latest version of master, and reduce the client configuration parameter max_include_resolution_depth to a value equal or greater than your maximum include level. This will avoid resolving circular references for a long time and running into maximum recursion depth.
Please let me know if this helps,
Cheers
Hey @afraazali, @kasrazahir did the above comment help?
I'm having the same problem with 1.13.1.
client.entries({'limit': 1})
results in RecursionError: maximum recursion depth exceeded while calling a Python object
I tried using the max_include_resolution_depth
parameter, as suggested above, but it's rejected by the server:
client.entries({'limit': 1, 'include': 1, 'max_include_resolution_depth': 1})
returns:
BadRequestError: HTTP status code: 400
Message: The query you sent was invalid. Probably a filter or ordering specification is not applicable to the type of a field.
Details: The path "max_include_resolution_depth" is not recognized
max_include_resolution_depth
is an optional parameter on client initialization, not entry retrieval. example: contetnful.Client(...,max_include_resolution_depth=XX)
I am also having this issue even with 1 include
. I set reuse_entries
to True
in the client configuration and that seemed to help. I am on the latest version - 1.13.1
99littlebugs commented: I am also having this issue even with 1 include. I set reuse_entries to True in the client configuration and that seemed to help. I am on the latest version - 1.13.1
Limiting depth didn't help me either. So instead, I took this approach (reuse_entries) as well and it solved my problem.
@tjtripp can you please share your client initialisation and entries retrieval code?
@rubydog - Sure - it's pretty much straight from the examples. I added the resue_entries parameter and that fixed the max recursion error. Now my queries work. Then I added the timeout_s and max_rate_limit_retries parameters to solve a rate limit issue.
client = contentful.Client(
space_id,
api_key,
reuse_entries=True,
timeout_s=5,
max_rate_limit_retries=3
)
entry = client.entry(entry_id)
So does it work then with resue_entries
param?
Yes, it works - I'll edit my comments to state that it works. Thanks!
For me the issue persists, even with
max_include_resolution_depth=0
,
reuse_entries=True
,
in Contentfull class initialization
and include=1
as query parameter :(
Hi we're using the python SDK and trying to retrieve list of entries of a specific type using this method
data = client.entries({"content_type": 'video'})
there are around 150 contents of this type and we're getting the following error
File "/Users/mesadat/Documents/content-recommender/venv/lib/python3.7/site-packages/contentful/resource.py", line 54, in _hydrate_sys for k, v in item.get('sys', {}).items(): RecursionError: maximum recursion depth exceeded while calling a Python object
we are using the same method on other content types without an issue, they don't have as many entries so we're suspecting maybe the large number of content may be causing this error