我已经将项目加载到Apify云中,当我使用输入运行它时,问题非常有趣:No found!。不过,它在我的电脑上运行得很顺利。
运行日志:
2019-08-20T13:17:57.313Z ACTOR: Creating Docker container.
2019-08-20T13:17:58.013Z ACTOR: Starting Docker container.
2019-08-20T13:17:59.614Z INFO: System info {"apifyVersion":"0.13.7","apifyClientVersion":"0.5.14","osType":"Linux","nodeVersion":"v10.16.0"}
2019-08-20T13:18:00.081Z input: null
2019-08-20T13:18:00.083Z The function passed to Apify.main() threw an exception:
2019-08-20T13:18:00.085Z TypeError: Cannot read property 'concurrency' of null
2019-08-20T13:18:00.086Z at Apify.main (/home/myuser/main.js:71:36)
2019-08-20T13:18:00.087Z at process._tickCallback (internal/process/next_tick.js:68:7)输入:
{
"page_handle_max_wait_time" : 2,
"concurrency" : 6,
"max_requests_per_crawl" : 10000,
"retireInstanceAfterRequestCount": 5000,
...
}代码有一种很好的方式来调用输入:
const store = await Apify.openKeyValueStore('default');
const input = await store.getValue('INPUT');
console.log('input:', input);日志显示输入变量是null.
你能解释一下为什么吗?
发布于 2019-08-20 14:00:14
在云中,默认存储不是名为" default“(基本上只是本地运行中的一个虚拟名称)。要打开默认存储,只需调用不带任何参数的openKeyValueStore:
const store = await Apify.openKeyValueStore();
const input = await store.getValue('INPUT'); 这在当地也能用。
默认存储中的记录有一个较短的版本:
const input = await Apify.getValue('INPUT'); 或优先输入:
const input = await Apify.getInput();https://stackoverflow.com/questions/57575129
复制相似问题