Javascript Fetch method gives me 404 Error, but async/await works fine. Also works fine when using breakpoints. What is going on?

I’m just learning about this topic and I was trying this code:

let srcTxt;
let src = fetch("https://dog.ceo/api/breeds/image/random")
    .then(response => response.json())
    .then(data => {
        srcTxt = data.message;
        data.message
    })
    .catch(error => console.log(error));

But I get Error 404: not found.

I tryied to debug on console and, when hitting a breakpoint after my fetch request and then resuming, the code works fine.

I changed to async – await syntax instead and it works perfectly fine as well.

Can anyone help me to understand what is happening?

I’m using a live server from WebStorm.