Skip to content

handledAt type check not in sync with crawlee #307

@magne4000

Description

@magne4000

Crawlee specifies that handleAt should be an ISO datetime string, but I have a type validation error with the following code:

const requestQueue = await Actor.openRequestQueue();
const nowISO = new Date().toISOString();

await requestQueue.addRequests(
  someData.map((d) => ({
    method: 'GET',
    uniqueKey: d.url,
    url: d.url,
    handledAt: nowISO,
    state: RequestState.DONE,
  })),
);

When running this code inside apify prod environement:

ERROR Request batch insert failed
ApifyApiError: Invalid value provided in requests: requests.0.handledAt must be of type Date(details: type=schema-validation)
  clientMethod: RequestQueueClient.batchAddRequests
  statusCode: 400
  type: schema-validation
  attempt: 1
  httpMethod: post
  path: /v2/request-queues/BMM7W3VSBmYUgGprd/requests/batch
  stack:
    at makeRequest (/usr/src/app/packages/hearthstone/node_modules/.pnpm/[email protected]/node_modules/apify-client/dist/http_client.js:183:30)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestQueueClient._batchAddRequests (/usr/src/app/packages/hearthstone/node_modules/.pnpm/[email protected]/node_modules/apify-client/dist/resource_clients/request_queue.js:136:26)
    at async RequestQueueClient._batchAddRequestsWithRetries (/usr/src/app/packages/hearthstone/node_modules/.pnpm/[email protected]/node_modules/apify-client/dist/resource_clients/request_queue.js:159:34)

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions