Closed Nico-Mayer closed 1 year ago
Could you share the exact errors? Please follow the issue template and also include the trace logs if possible to help me pinpoint the exact issue.
I init shieldbow like this:
const shieldbow = new Shieldbow(keys.riotApiKey)
shieldbow.initialize({
cache: false,
storage: {
enable: {
api: false,
dragon: true,
},
},
region: 'euw',
logger: {
enable: true,
level: 'WARN',
},
ratelimiter: {
strategy: 'spread',
throw: true,
retry: {
retries: 5,
retryDelay: 5000,
},
},
fetch: {
champions: true,
items: true,
runes: true,
summonerSpells: true,
},
})
This is the error:
C:\Users\user\github\project\node_modules\.pnpm\axios@1.3.4\node_modules\axios\lib\core\settle.js:19
reject(new AxiosError(
^
AxiosError: Request failed with status code 404
at settle (C:\Userss\user\github\project\node_modules\.pnpm\axios@1.3.4\node_modules\axios\lib\core\settle.js:19:12)
at BrotliDecompress.handleStreamEnd (C:\Userss\user\github\project\node_modules\.pnpm\axios@1.3.4\node_modules\axios\lib\adapters\http.js:556:11)
at BrotliDecompress.emit (node:events:524:35)
at BrotliDecompress.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1359:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ERR_BAD_REQUEST',
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: [class Blob] },
validateStatus: [Function: validateStatus],
headers: AxiosHeaders {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/1.3.4',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
baseURL: 'https://ddragon.leagueoflegends.com/cdn/',
method: 'get',
url: 'https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions/Milio.json',
data: undefined
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
finish: [Function: requestOnFinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'cdn.merakianalytics.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'cdn.merakianalytics.com',
_closeAfterHandlingError: false,
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
timeout: 5000,
parser: null,
_httpMessage: null,
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: -1,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: [Timeout],
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: true,
[Symbol(kSetKeepAliveInitialDelay)]: 1,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'GET /riot/lol/resources/latest/en-US/champions/Milio.json HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/1.3.4\r\n' +
'Accept-Encoding: gzip, compress, deflate, br\r\n' +
'Host: cdn.merakianalytics.com\r\n' +
'Connection: keep-alive\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype],
keepAliveMsecs: 1000,
keepAlive: true,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 3,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/riot/lol/resources/latest/en-US/champions/Milio.json',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: null,
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
joinDuplicateHeaders: undefined,
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 404,
statusMessage: 'Not Found',
client: [TLSSocket],
_consuming: true,
_dumped: false,
req: [Circular *1],
responseUrl: 'https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions/Milio.json',
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 26,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'cdn.merakianalytics.com',
protocol: 'https:',
_redirectable: Writable {
_writableState: [WritableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular *1],
_currentUrl: 'https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions/Milio.json',
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'user-agent': [Array],
'accept-encoding': [Array],
host: [Array]
},
[Symbol(errored)]: null,
[Symbol(kUniqueHeaders)]: null
},
response: {
status: 404,
statusText: 'Not Found',
headers: AxiosHeaders {
date: 'Fri, 24 Mar 2023 07:23:06 GMT',
'content-type': 'text/html',
'transfer-encoding': 'chunked',
connection: 'keep-alive',
'cache-control': 'max-age=14400',
'cf-cache-status': 'EXPIRED',
'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=DewsNtihBlh3HH0GEACEK4WEkMVSCkL2CinAKEcQt5%2BI0rgQXLVUncP6SsTq%2FTvR5m0Tjv%2BYfCMnFKzJNYS2V6Y3MC%2BBaTCVzbtmS18KBHCqUFQKTkdqwY4VUdkNNQzDUlscuT3cQaUOMfTM06dHyjJUvR6smw%3D%3D"}],"group":"cf-nel","max_age":604800}',
nel: '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}',
vary: 'Accept-Encoding',
server: 'cloudflare',
'cf-ray': '7acd2ab06b3f3807-FRA',
'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400'
},
config: {
transitional: [Object],
adapter: [Array],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: [Object],
validateStatus: [Function: validateStatus],
headers: [AxiosHeaders],
baseURL: 'https://ddragon.leagueoflegends.com/cdn/',
method: 'get',
url: 'https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions/Milio.json',
data: undefined
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
data: '<html>\n' +
'<head><title>404 Not Found</title></head>\n' +
'<body bgcolor="white">\n' +
'<center><h1>404 Not Found</h1></center>\n' +
'<hr><center>nginx/1.13.8</center>\n' +
'</body>\n' +
'</html>\n'
}
}
I'm able to reproduce the same error with 2.0.1
using the same ClientConfig
. It is an unhandled promise rejection from axios
so a try...catch around the .initialize
method will not capture it. I think it might be happening here.
That if (response.status !== 200)
check will never happen since axios
will throw an error on unsuccessful responses, so the rejection just bubbles up unhandled instead.
Anyways, it seems that the Meraki upstream resource does not have Milio yet as an individual JSON file. Yet, Milio is in the aggregate champions.json. (゚▽゚`*)?
Could try getting the full champions JSON instead and share it around during the initialization phase?
2.0.2 incoming I guess
v2.0.2 is being released, and this has been addressed in it.
Since Milio release Axios is throwing errors.