Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run under Windows (path contains invalid characters) #98

Open
AXYZE9 opened this issue May 9, 2024 · 1 comment
Open

Cannot run under Windows (path contains invalid characters) #98

AXYZE9 opened this issue May 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@AXYZE9
Copy link

AXYZE9 commented May 9, 2024

Windows 10 22H2, Node 18

Running my own config or sample ones always causes this issue:

yarn start -p simple.json
Sender::constructor
Sender::init
Webhook::constructor
Webhook not configured; if you want to use a webhook, set the WEBHOOK_URL environment variable or provide the webhook_url option in the config
DefaultScraper::constructor
Sender::updateSettings
C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\node_modules\fs-extra\lib\mkdirs\utils.js:16
      const error = new Error(`Path contains invalid characters: ${pth}`)
                    ^

Error: Path contains invalid characters: C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\storage\request_queues\["https:\platform.openai.com\docs"]
    at checkPath (C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\node_modules\fs-extra\lib\mkdirs\utils.js:16:21)
    at module.exports.makeDir (C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\node_modules\fs-extra\lib\mkdirs\make-dir.js:12:3)
    at Object.defineProperty.value (C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\node_modules\universalify\index.js:21:45)
    at RequestQueueFileSystemEntry.update (C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\node_modules\@crawlee\memory-storage\fs\request-queue\fs.js:61:44)
    at async RequestQueueClient.batchAddRequests (C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\node_modules\@crawlee\memory-storage\resource-clients\request-queue.js:322:13)
    at async RequestQueue.addRequests (C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\node_modules\@crawlee\core\storages\request_queue.js:371:28)
    at async Crawler.run (C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\dist\src\crawler.js:40:9)
    at async C:\Users\AXYZE\Downloads\scrapix-0.1.9\scrapix-0.1.9\dist\src\bin\index.js:56:5 {
  code: 'EINVAL'
}

As we can see it throws error because it wants to name folder like full URL "storage\request_queues["https:\platform.openai.com\docs"]" which of course won't work.
It looks like it is transforming "start_urls": ["https://platform.openai.com/docs"] from sample config to ["https:\platform.openai.com\docs"].

None of simple solutions like removing "https://", changing that to string by removing square brackets work.

Issue should be fixed by either transforming URL differently, hardcoding some kind of value or getting name from different parameter, maybe from "meilisearch_index_uid" parameter.

I'm trying to modify 40 line of "dist/src/crawler.js" file in order to transform that value, but so far I'm not able to
await requestQueue.addRequests(this.urls.map((url) => ({ url })));

@curquiza curquiza added the bug Something isn't working label May 13, 2024
@curquiza
Copy link
Member

Hello @AXYZE9
thanks for the report and sorry for the trouble. Any PRs are welcome for this ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants