You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to integrate some triggers (both Rest and Polling for dynamic dropdowns) for an API that provides pagination through cursors and the links in the header (rfc 8288).
I see that the z object provides a cursor that stores the value for one hour, so I've tried with this cli example https://github.com/zapier/zapier-platform/blob/main/packages/cli/snippets/paging-cursor.js and adapted it a bit to return an array but I get the error Invalid cursor operation. 'z.cursor' can only be used in 'perform' methods of polling triggers or 'performList' methods of hook triggers, and when 'canPaginate' is 'true'. (the pagination checkbox is enabled)
Reproduction Steps
I've tried with a bunch of different attempts:
constperform=async(z,bundle)=>{letcursor;// if fetching a page other than the first (first page is 0),// get the cursor stored after fetching the previous page.if(bundle.meta.page>0){cursor=awaitz.cursor.get();// if the previous page was the last one and cursor is empty/null,// return an empty array.if(!cursor){return[];}}constresponse=awaitz.request('https://5ae7ad3547436a00143e104d.mockapi.io/api/recipes',{// cursor typically is a param to pass along to the next request,// or the full URL for the next page of items.params: { cursor },});// after fetching a page, set the returned cursor for the next page,// or an empty string if the cursor is nullawaitz.cursor.set(response.nextPage??'');returnresponse.items;};returnperform(z,bundle).then(results=>results);
letcursor;// if fetching a page other than the first (first page is 0),// get the cursor stored after fetching the previous page.if(bundle.meta.page>0){cursor=awaitz.cursor.get();// if the previous page was the last one and cursor is empty/null,// return an empty array.if(!cursor){return[];}}constresponse=awaitz.request('https://5ae7ad3547436a00143e104d.mockapi.io/api/recipes',{// cursor typically is a param to pass along to the next request,// or the full URL for the next page of items.params: { cursor },});// after fetching a page, set the returned cursor for the next page,// or an empty string if the cursor is nullawaitz.cursor.set(response.nextPage??'');returnresponse.items;
Zapier Platform version
online editor
Node.js version
online editor
Your Operating System
No response
npm/yarn version
No response
App ID
No response
More Details
No response
The text was updated successfully, but these errors were encountered:
Bug Description
I'm trying to integrate some triggers (both Rest and Polling for dynamic dropdowns) for an API that provides pagination through cursors and the links in the header (rfc 8288).
I see that the
z
object provides acursor
that stores the value for one hour, so I've tried with this cli example https://github.com/zapier/zapier-platform/blob/main/packages/cli/snippets/paging-cursor.js and adapted it a bit to return an array but I get the errorInvalid cursor operation. 'z.cursor' can only be used in 'perform' methods of polling triggers or 'performList' methods of hook triggers, and when 'canPaginate' is 'true'.
(the pagination checkbox is enabled)Reproduction Steps
I've tried with a bunch of different attempts:
Zapier Platform version
online editor
Node.js version
online editor
Your Operating System
No response
npm/yarn version
No response
App ID
No response
More Details
No response
The text was updated successfully, but these errors were encountered: