klayveR/poe-ninja-api-manager

Getting CORS error

gabriel-dehan opened this issue · 1 comments

Access to fetch at 'https://poe.ninja/api/data/itemoverview?league=Metamorph&type=DivinationCard' from origin 'https://cadiro.herokuapp.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I guess this project is dead for distant servers because of that now, just wanted to check with you though. Maybe I am missing something but they seem to have blocked any cross origin requests.

That might be the case, I have never tried using the module on a server. You could try something like the following to confirm that this is an issue with poe.ninja and not this module:

import * as request from "request-promise-native";

const url = "https://poe.ninja/api/data/itemoverview?league=Metamorph&type=DivinationCard";

(async () => {
    try {
        const response = await request.get({
            json: true,
            url,
        });

        // Hooray
        console.log(response);
    } catch (e) {
        console.error(e);
    }
})();