question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Worker: true error Failed to execute 'open' on 'XMLHttpRequest': Invalid URL

See original GitHub issue

Full error:

Uncaught DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL
    at l._readChunk (blob:http://localhost:8080/0b8053c6-ba21-4708-8fbe-cf0ee7c7f2ed:1:7241)
    at l._nextChunk (blob:http://localhost:8080/0b8053c6-ba21-4708-8fbe-cf0ee7c7f2ed:1:6870)
    at l.stream (blob:http://localhost:8080/0b8053c6-ba21-4708-8fbe-cf0ee7c7f2ed:1:6977)
    at Object.parse (blob:http://localhost:8080/0b8053c6-ba21-4708-8fbe-cf0ee7c7f2ed:1:1097)
    at f.onmessage (blob:http://localhost:8080/0b8053c6-ba21-4708-8fbe-cf0ee7c7f2ed:1:18176)

The code - which works fine when I don’t include worker: true:

function downloadWeather(location: string) {
  weather[location] = [];
  let rowNumber = 0;
  Papa.parse(`/data/WeatherRaw${location}.csv`, {
    download: true,
    dynamicTyping: true,
    header: true,
    worker: true,
    step(row: any) {
      weather[location].push(row.data as RawWeatherType);
    },
    complete() {
      console.log('Weather downloaded for ' + location);
    },
  });
}

The only two things I can think of are a bug in the library (unlikely), or that I need to set up something special in webpack to work with webworkers? Here’s my webpack file: https://github.com/toddmedema/electrify/blob/master/shared/webpack.shared.js

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
travis-southcommented, Jul 29, 2021

I’m experiencing the same error, @toddmedema how did you fix/workaround it?

0reactions
Jake-Prenticecommented, Dec 3, 2021

since download and workers don’t work together, I opted for using the fetch api like this:

const data = await fetch(csvPath)
const blob = await data.blob();

Papa.parse(blob, {
   worker: true,
   ...
})

Don’t know if this is a good solution, but hope it helps someone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute 'open' on 'XMLHttpRequest': Invalid URL
This is an invalid URL (just like the error message says). If you have a : after the hostname, it must be followed...
Read more >
Failed to execute 'open' on 'XMLHttpRequest': Invalid URL
When trying to connect to RethinkDB through Node's REPL, I have no issue. However, when running the exact same code in my React...
Read more >
Failed to execute 'open' on 'XMLHttpRequest' : invalid URL
Hi, I'm new in ionic 3 , I try to make a login post to API, here is my api provider export class...
Read more >
failed to execute 'open' on 'xmlhttprequest': invalid url - You.com
I get this error : DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL. I read I need to replace the port by...
Read more >
Invalid URL / Uncaught SyntaxError: Failed to execute 'open ...
Description. Malformed URIs occur when you run encodeURIComponent on something that cannot be encoded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found