Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
In getValue() removing checks for output of getRecord()
Marek Trunkata8cfa40ad737
diff --git a/src/actor.js b/src/actor.jsindex fa6a6708a..2c9029d51 100644--- a/src/actor.js+++ b/src/actor.js@@ -54,17 +54,6 @@ export const getValue = (key, callback = null) => {key,rawBody: true,});- })- .then((recordBody) => {- if (!recordBody) {- return null;- }-- if (!_.isString(recordBody) && !Buffer.isBuffer(recordBody)) {- throw new Error('ApifyClient returned an unexpected value from keyValueStores.getRecord(): body must be String or Buffer.');- }-- return recordBody;});return nodeifyPromise(promise, callback);diff --git a/test/actor.js b/test/actor.jsindex 456ac4ab9..0ce9155b7 100644--- a/test/actor.js+++ b/test/actor.js@@ -395,51 +395,6 @@ describe('Apify.getValue()', () => {mock.restore();});});-- it('returns null on undefined keyValueStores.getRecord() result', () => {- process.env.APIFY_DEFAULT_KEY_VALUE_STORE_ID = '1234';- const mock = sinon.mock(Apify.client.keyValueStores);- mock.expects('getRecord')- .once()- .returns(Promise.resolve(undefined));-- return Promise.resolve()- .then(() => {- return Apify.getValue('BLA BLA');- })- .then((input) => {- expect(input).to.be.eql(null);- mock.verify();- })- .finally(() => {- mock.restore();- });- });-- it('fails on invalid keyValueStores.getRecord() result', () => {- process.env.APIFY_DEFAULT_KEY_VALUE_STORE_ID = '1234';- const mock = sinon.mock(Apify.client.keyValueStores);- mock.expects('getRecord')- .once()- .returns(Promise.resolve({ invalid: 'bla bla' }));-- return Promise.resolve()- .then(() => {- return Apify.getValue('ANYTHING REALLY');- })- .then(() => {- expect.fail();- })- .catch((err) => {- expect(err.message).to.contain('ApifyClient returned an unexpected value');- })- .then(() => {- mock.verify();- })- .finally(() => {- mock.restore();- });- });});describe('Apify.setValue()', () => {