Skip to content

Instantly share code, notes, and snippets.

@omikader
Created May 15, 2024 15:56
Show Gist options
  • Select an option

  • Save omikader/efe8c75eff27c36a4edeb782ddf59006 to your computer and use it in GitHub Desktop.

Select an option

Save omikader/efe8c75eff27c36a4edeb782ddf59006 to your computer and use it in GitHub Desktop.
Apify update task errors
// Real task/org IDs omitted for privacy
> console.log(JSON.stringify(await client.task("abc123").get(), null, 2))
{
...
"createdAt": "2024-05-15T15:26:07.891Z",
"modifiedAt": "2024-05-15T15:45:10.156Z",
"stats": {
"totalRuns": 2,
"lastRunStartedAt": "2024-05-15T15:26:34.035Z"
},
"options": {
"memoryMbytes": 4096
},
"input": {
"aggressivePrune": false,
"crawlerType": "cheerio",
"debugLog": false,
"debugMode": false,
"dynamicContentWaitSecs": 5,
"ignoreCanonicalUrl": false,
"removeCookieWarnings": false,
"saveFiles": false,
"saveHtml": false,
"saveMarkdown": false,
"saveScreenshots": false,
"startUrls": [
{
"url": "https://support.demandbase.com/hc/en-us"
}
],
"useSitemaps": false
}
}
> await client.task("abc123").update({ input: { "crawlerType": "playwright:firefox" } })
Uncaught ApifyApiError: Input is not valid: Field input.startUrls is required
clientMethod: TaskClient.update
statusCode: 400
type: invalid-input
attempt: 1
httpMethod: put
path: /v2/actor-tasks/abc123
stack:
at makeRequest (/Users/omar/GitHub/embrace/node_modules/.pnpm/apify-client@2.9.3/node_modules/apify-client/dist/http_client.js:184:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async TaskClient._update (/Users/omar/GitHub/embrace/node_modules/.pnpm/apify-client@2.9.3/node_modules/apify-client/dist/base/resource_client.js:34:26)
at async REPL9:1:33
at async node:repl:645:29 {
clientMethod: 'TaskClient.update',
statusCode: 400,
type: 'invalid-input',
attempt: 1,
httpMethod: 'put',
path: '/v2/actor-tasks/abc123',
originalStack: '\n' +
' at makeRequest (/Users/omar/GitHub/embrace/node_modules/.pnpm/apify-client@2.9.3/node_modules/apify-client/dist/http_client.js:184:30)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async TaskClient._update (/Users/omar/GitHub/embrace/node_modules/.pnpm/apify-client@2.9.3/node_modules/apify-client/dist/base/resource_client.js:34:26)\n' +
' at async REPL9:1:33\n' +
' at async node:repl:645:29'
}
> await client.task("abc123").updateInput({ "crawlerType": "playwright:firefox" })
{
aggressivePrune: false,
crawlerType: 'playwright:firefox',
debugLog: false,
debugMode: false,
dynamicContentWaitSecs: 5,
ignoreCanonicalUrl: false,
removeCookieWarnings: false,
saveFiles: false,
saveHtml: false,
saveMarkdown: false,
saveScreenshots: false,
startUrls: [ { url: 'https://support.demandbase.com/hc/en-us' } ],
useSitemaps: false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment