Google App Engine NDB – Cursor on query working on local dev but not in production

Home / Uncategorized / Google App Engine NDB – Cursor on query working on local dev but not in production

Question:
I have an issue. I call a query with a cursor which is set to the Cursor() first time around. I fetch 50 items from the query
qry = cls.query(cls.store == store_id, cls.user != exclude_user, cls.active == True, cls.offline == False).order(cls.user, cls._key, -cls.created)

I return that qry to the calling class and run the following fetch
result, next_cursor, more = qry.fetch_page(pagination, start_cursor=cursor)

This works no problem, I then do the following with the cursor and pass it back to the client as per the docs:client_params[‘next_page’] = next_cursor.urlsafe()

I have logged this cursor to make sure it is the same on the return call to the server, which it is

I get it thus:cursor = Cursor(urlsafe=page)

However the second attempt to retrieve the next 50 or less items always results in the following error:BadRequestError: cursor position is outside the range of the original query

Now this whole process works fine on the local development machine but not in production


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *