l-portet / surebet-finder

🏈 💶 Sport surebet finder bot
63 stars 18 forks source link

Error: Unable to call API #2

Closed pablolive1 closed 4 years ago

pablolive1 commented 4 years ago

Hello Friend. help me please ... I have this error:

Error: Unable to call API (node:7608) UnhandledPromiseRejectionWarning: Error: Request failed with status code 403 at createError (C:\Program Files\nodejs\Nova pasta\node_modules\axios\lib\core\createError.js:16:15) at settle (C:\Program Files\nodejs\Nova pasta\node_modules\axios\lib\core\settle.js:17:12) at IncomingMessage.handleStreamEnd (C:\Program Files\nodejs\Nova pasta\node_modules\axios\lib\adapters\http.js:236:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1221:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) (node:7608) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:7608) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

l-portet commented 4 years ago

Have you properly set your API key in your env via the API_KEY variable?

pablolive1 commented 4 years ago

Hello. the .env file looks like this:

API_KEY = https://app.oddsapi.io/api/v1/odds?apikey=cbaa2940-cad8-11ea-ac3a-3f239ac4047a

l-portet commented 4 years ago

You're setting a whole URL whereas the program expects only the API key. Try to set it like the example below and it should fix your problem. API_KEY=cbaa2940-cad8-11ea-ac3a-3f239ac4047a

Btw, I strongly recommend you to renew your API key since it's now public. 😉

flrnt commented 4 years ago

Salut !

It seems like the baseURL is no longer the same ; i.e got Error: Unable to call API even tho the .env + API_KEY are correctly set And also, their new API doesnt accept /odds anymore, but require a match_id, /soccer/odds/:match_id

Kuhicop commented 3 years ago

I still have this issue, testing with .env file with content: API_KEY=5cda69f0-602a-11eb-bda5-9fe4ff83ae5c1c

l-portet commented 3 years ago

Sorry, @flrnt did not see your comment (pretty old now)! Actually, I don't have the time to maintain this project anymore... Especially if the API structure seems to have changed. Feel free to fork it :)