Search code examples
node.jsreactjsmeteorlast.fm

last.fm GET request timing out meteor


I'm currently trying to access last.fm's API using a simple GET request. The best NPM library I found was last-fm by feross. The problem is that my request keeps timing out and I don't get any errors. Is meteor causing this?

My request URL is: https://ws.audioscrobbler.com:3000/2.0/?method=artist.getInfo&artist=cher&autocorrect=1&api_key=MY_API_KEY&format=json

Here is the code.

import LastFM from 'last-fm';

const lastfm = new LastFM("MY_API_KEY", {userAgent: "buildsmoothie"})

export const ArtistCheck = () => {
  lastfm.artistInfo({ name: "cher" }, (err, data) => {
    if (err) console.log(err)
    else console.log(data)
  })
}

And then I call it in another component here:

artistGateCheck(e){
    e.preventDefault();
      ArtistCheck();
    }

Solution

  • I've removed the port :3000 and it works as it should. Used the follow url:

    https://ws.audioscrobbler.com/2.0/?method=artist.getInfo&artist=cher&autocorrect=1&api_key=MY_API_KEY&format=json