LeviathanLevi / Coinbase-Pro-Crypto-Trading-Bot-CrypFinder

This is a crypto trading bot made in NodeJS that uses the coinbase pro API.
157 stars 55 forks source link

401 Error on fee call #27

Closed Paddockson closed 3 years ago

Paddockson commented 3 years ago

Im getting a 401 error when running the program:

`{"level":50,
"time":1624162258647,
"pid":25316,
"hostname":"DESKTOP-3IUF1FO",
"message":"Error occurred in getFees method.",
"errorMsg":{},
"err":{"message":"Request failed with status code 401",
"stack":"Error: Request failed with status code 401\n    at createError (C:\\Users\\mattp\\Paddockson\\Coinbase-Pro-Crypto-Trading-Bot-CrypFinder\\node_modules\\axios\\lib\\core\\createError.js:16:15)\n    at settle (C:\\Users\\mattp\\Paddockson\\Coinbase-Pro-Crypto-Trading-Bot-CrypFinder\\node_modules\\axios\\lib\\core\\settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (C:\\Users\\mattp\\Paddockson\\Coinbase-Pro-Crypto-Trading-Bot-CrypFinder\\node_modules\\axios\\lib\\adapters\\http.js:260:11)\n    at IncomingMessage.emit (events.js:387:35)\n    at endReadableNT (internal/streams/readable.js:1317:12)\n    at processTicksAndRejections (internal/process/task_queues.js:82:21)",
"config":{"url":"https://api-public.sandbox.pro.coinbase.com/fees",
"method":"get",
"headers":{"Accept":"application/json,
 text/plain,
 */*",
"CB-ACCESS-KEY":"<f7a78bd0abb31d67c6eb7438cb38b452>",
"CB-ACCESS-SIGN":"YENTiJaERNPVt15E9jHOhSICCu0DdH1bbqalHX2tPYo=",
"CB-ACCESS-TIMESTAMP":1624162258.52,
"CB-ACCESS-PASSPHRASE":"<30d5zfbdjv7>",
"User-Agent":"axios/0.21.1"},
"transformRequest":[null],
"transformResponse":[null],
"timeout":0,
"xsrfCookieName":"XSRF-TOKEN",
"xsrfHeaderName":"X-XSRF-TOKEN",
"maxContentLength":-1,
"maxBodyLength":-1}}}
{"level":50,
"time":1624162258648,
"pid":25316,
"hostname":"DESKTOP-3IUF1FO",
"message":"Error occurred in bot,
 shutting down. Check the logs for more information.",
"errorMsg":{},
"err":{"message":"Request failed with status code 401",
"stack":"Error: Request failed with status code 401\n    at createError (C:\\Users\\mattp\\Paddockson\\Coinbase-Pro-Crypto-Trading-Bot-CrypFinder\\node_modules\\axios\\lib\\core\\createError.js:16:15)\n    at settle (C:\\Users\\mattp\\Paddockson\\Coinbase-Pro-Crypto-Trading-Bot-CrypFinder\\node_modules\\axios\\lib\\core\\settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (C:\\Users\\mattp\\Paddockson\\Coinbase-Pro-Crypto-Trading-Bot-CrypFinder\\node_modules\\axios\\lib\\adapters\\http.js:260:11)\n    at IncomingMessage.emit (events.js:387:35)\n    at endReadableNT (internal/streams/readable.js:1317:12)\n    at processTicksAndRejections (internal/process/task_queues.js:82:21)",
"config":{"url":"https://api-public.sandbox.pro.coinbase.com/fees",
"method":"get",
"headers":{"Accept":"application/json,
 text/plain,
 */*",
"CB-ACCESS-KEY":"<f7a78bd0abb31d67c6eb7438cb38b452>",
"CB-ACCESS-SIGN":"YENTiJaERNPVt15E9jHOhSICCu0DdH1bbqalHX2tPYo=",
"CB-ACCESS-TIMESTAMP":1624162258.52,
"CB-ACCESS-PASSPHRASE":"<30d5zfbdjv7>",
"User-Agent":"axios/0.21.1"},
"transformRequest":[null],
"transformResponse":[null],
"timeout":0,
"xsrfCookieName":"XSRF-TOKEN",
"xsrfHeaderName":"X-XSRF-TOKEN",
"maxContentLength":-1,
"maxBodyLength":-1}}}`

Im running this inside the sandbox I currently have under $200 in one portfolio and 0 in the default, I have also tried depositing the money into the default portfolio in case this was the issue.

I saw a similar error posted by user ylmcc and he resolved this issue by querying the API, I have built my own API around coinbase and was able query the API fine and retry but the same error persists.

I have also made sure my machine IP is on the whitelist.

Paddockson commented 3 years ago

After some debugging the white list was incorrect, if anyone encounters this issue just ensure that while debugging read through the error the coinbase lib is returning