genetic-orange
genetic-orange2y ago

Apify API not working

I'm developing a custom actor for my project and it fully works as I intended it but when I use the apify API to interact with it programmatically the actor doesn't seem to be receiving the inputs as it should be. I send it as JSON properly and everything but it gives me the error:
2024-03-05T03:14:23.013Z undefined:1
2024-03-05T03:14:23.014Z [object Object]
2024-03-05T03:14:23.015Z ^
2024-03-05T03:14:23.016Z
2024-03-05T03:14:23.017Z SyntaxError: Unexpected token o in JSON at position 1
2024-03-05T03:14:23.018Z at JSON.parse (<anonymous>)
2024-03-05T03:14:23.019Z at file:///usr/src/app/src/main.js:65:26
2024-03-05T03:14:23.020Z at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-03-05T03:14:23.023Z
2024-03-05T03:14:23.026Z Node.js v18.19.1
2024-03-05T03:14:23.013Z undefined:1
2024-03-05T03:14:23.014Z [object Object]
2024-03-05T03:14:23.015Z ^
2024-03-05T03:14:23.016Z
2024-03-05T03:14:23.017Z SyntaxError: Unexpected token o in JSON at position 1
2024-03-05T03:14:23.018Z at JSON.parse (<anonymous>)
2024-03-05T03:14:23.019Z at file:///usr/src/app/src/main.js:65:26
2024-03-05T03:14:23.020Z at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-03-05T03:14:23.023Z
2024-03-05T03:14:23.026Z Node.js v18.19.1
Not really sure where to go from here, but i'd appreciate any help.
4 Replies
genetic-orange
genetic-orangeOP2y ago
Just as a follow up it appears to be scraping properly just is having issues processing everything from there
Oleg V.
Oleg V.2y ago
Could you please provide a code snippet or a reproduction of the issue? It's difficult to offer assistance having only the error trace above.
genetic-orange
genetic-orangeOP2y ago
Hey so im not at my computer rn but I can explain it When I run apify api from postman or dashboard it scrapes without issue When I run it from heroku i THINK target site is blocking me Im using proxies as well on the http reqs Im solving their antibot and everything I realize it may be a problem with the server getting blocked but the fact that its still catching me through my proxies idrk what to do
Oleg V.
Oleg V.2y ago
Try to log response from your target site. Also, here is some article for inspiration: https://docs.apify.com/academy/node-js/analyzing-pages-and-fixing-errors Otherwise, still, providing some code snippets / full reproduction, you use, is the best way to go.

Did you find this page helpful?