Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

personio-bot returns with error AxiosError: Request failed with status code 403 #14

Open
ThreshTheRed opened this issue Jan 15, 2024 · 1 comment

Comments

@ThreshTheRed
Copy link

ThreshTheRed commented Jan 15, 2024

We're running it on ubuntu 20.04.
axios version 1.6.5
npm 10.2.4
node 21.5.0

This suddenly stopped running at 12th of January 2024

Here's the error

[AxiosError: Request failed with status code 403] { code: 'ERR_BAD_REQUEST', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [Function: httpAdapter], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function] }, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, */*', 'User-Agent': 'axios/0.27.2' }, method: 'get', url: 'https://www.daysoftheyear.com', 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)], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: false, _SNICallback: null, servername: 'www.daysoftheyear.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 10, connecting: false, _hadError: false, _parent: null, _host: 'www.daysoftheyear.com', _readableState: [ReadableState], _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: [TLSWrap], _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular *1], [Symbol(res)]: [TLSWrap], [Symbol(verified)]: true, [Symbol(pendingSession)]: null, [Symbol(async_id_symbol)]: 9, [Symbol(kHandle)]: [TLSWrap], [Symbol(kSetNoDelay)]: false, [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(connect-options)]: [Object], [Symbol(RequestTimeout)]: undefined }, _header: 'GET / HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'User-Agent: axios/0.27.2\r\n' + 'Host: www.daysoftheyear.com\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: noopPendingOutput], agent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, scheduling: 'lifo', maxTotalSockets: Infinity, totalSocketCount: 2, maxCachedSessions: 100, _sessionCache: [Object], [Symbol(kCapture)]: false }, socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/', _ended: true, res: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 4, _maxListeners: undefined, socket: [TLSSocket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: [Object], rawHeaders: [Array], trailers: {}, rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 403, statusMessage: 'Forbidden', client: [TLSSocket], _consuming: true, _dumped: false, req: [Circular *1], responseUrl: 'https://www.daysoftheyear.com/', redirects: [], [Symbol(kCapture)]: false, [Symbol(RequestTimeout)]: undefined }, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'www.daysoftheyear.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://www.daysoftheyear.com/', [Symbol(kCapture)]: false }, [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] { accept: [Array], 'user-agent': [Array], host: [Array] } }, response: { status: 403, statusText: 'Forbidden', headers: { date: 'Mon, 15 Jan 2024 08:40:47 GMT', 'content-type': 'text/html; charset=UTF-8', 'content-length': '5858', connection: 'close', 'cross-origin-embedder-policy': 'require-corp', 'cross-origin-opener-policy': 'same-origin', 'cross-origin-resource-policy': 'same-origin', 'origin-agent-cluster': '?1', 'permissions-policy': 'accelerometer=(),autoplay=(),browsing-topics=(),camera=(),clipboard-read=(),clipboard-write=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()', 'cf-mitigated': 'challenge', 'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', expires: 'Thu, 01 Jan 1970 00:00:01 GMT', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'expect-ct': 'max-age=86400, enforce', 'referrer-policy': 'same-origin', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', server: 'cloudflare', 'cf-ray': '845cd0df1c7f36dd-FRA', 'alt-svc': 'h3=":443"; ma=86400' }, config: { transitional: [Object], adapter: [Function: httpAdapter], transformRequest: [Array], transformResponse: [Array], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: [Object], validateStatus: [Function: validateStatus], headers: [Object], method: 'get', url: 'https://www.daysoftheyear.com', data: undefined }, request: <ref *1> ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [TLSSocket], _header: 'GET / HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'User-Agent: axios/0.27.2\r\n' + 'Host: www.daysoftheyear.com\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'www.daysoftheyear.com', protocol: 'https:', _redirectable: [Writable], [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] }, data: <title>Just a moment...</title>

Enable JavaScript and cookies to continue
<script>(function(){window._cf_chl_opt={cvId: '2',cZone: "www.daysoftheyear.com",cType: 'managed',cNounce: '13406',cRay: '845cd0df1c7f36dd',cHash: '5dbe7dc977632c6',cUPMDTk: "\/?__cf_chl_tk=XRBE9FhqSdVynkPCsq1fSBA7vUGzLOmWdjZ6UbRAJ4s-1705308047-0-gaNycGzNCrs",cFPWv: 'b',cTTimeMs: '1000',cMTimeMs: '375000',cTplV: 5,cTplB: 'cf',cK: "visitor-time",fa: "\/?__cf_chl_f_tk=XRBE9FhqSdVynkPCsq1fSBA7vUGzLOmWdjZ6UbRAJ4s-1705308047-0-gaNycGzNCrs",md: "lXuvDii_9mAtWznR0jToBaHrrp0LNs5nOwfLWWZdQc4-1705308047-1-ATurPkPbru9TgK7I4bZNvAPYOeXGia-3pecqf2HzEhcZVXfsb82nh8dYVlqqbvEdlNO9asTuW0WieXVqd5XtuuarVYFhMl3conuPP9OjB2aU7hecY_gpD2LaKwlcFhTQc_9FaNnAlk64U1Dn_1zvTGFoDGUKskD_JphEGSrDBH52BjlxpUah7_UtGhgvGGIUjG7NW9Qw6CpDn75lJ7NOQ65dhMu4pV6MCUTQ6V-a1xo_xERynp2bMr3rIilECEHZB6daC38xvh2BqOmu5yOO0Zw2GBz244CKHqkKYJq07heXeWTr2Rcn-hyU7zYv7DavP2EI4KxFnT_yO8uqowsMQd5ULbgTcIV5HCCOMw_fLchzBkmz2aE0R1lu_2EuRxvRYrXC2AKP5IuQ8-hdwLpiCUpnT_db8XM2NZ9NiLEVW1_0UvQdvmuMxG7T5br2Hu2IE7-FmRSFD53wHWowFw-u7tangZQsoKjF7tJTv5tyvHZVwRK1rDhqD72DZgPyt8lOeKN16IUa01l_kfAReN-NTXSB4sZbn2WbclXwZzOyY_UxAQF8CfFsnJydzX5dliM3jqiyuH4P67tRceqQgVKrizgBIXIxzWXxroNNCKiENfLoa0gD399bv_TwPqzBRog_dogS-NshlnWWrnErqeuKrH901N6CiWmEVnuauLK5DzIxCfV9vBHdnsSJdWoiFdZnMIVBRC5U0m_J5DhgCvDyzW3_UpCwWn22Bqr_7eesyh5YLPBuHrBIVrX0KbV748Ut9DY1neBjugYD6ZOVbEnhgwT8Q_XEqD8hF0jEIeUGuKioCNGq31vdrGmc7W0bruz1suE0Rjhb4WhfEGx-cQD4-4V6M0rCQ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jD/Gui1X7c2bOfXO7l4S/wZewRSywReYnlJOkBfC8k9OVe1Oy7EzX42pAvPwNIt621ys8cB21ViQ0Vl1CVontW6v9GtIAde1Ws8cftRGRAt+afZmj9Y8xdvnMSGBcP3oSAZ2P31G2eEEicGyiZFuWew4J3cYBhNWDSh7Hio7wsM9HiexZXGKSLNzRPM5yUB5vrLoJqZaV0VDfSGUZStEuaHEsbNYmJgrYVfvs5xfPZE+DDB+0a0/yWr8LasogsiQJC1slStcFx4f7ZRdEM6C0r2nGZbk6oge2AaO1iXRCQW+ryGsVBfzI/joXJL8Wq61IEeYv63pp/qKbSLpCscuryUyCEhd+igGTgDDOZ0OvDGrxDJx2O2grg=',t: 'MTcwNTMwODA0Ny4yMjIwMDA=',cT: Math.floor(Date.now() / 1000),m: 'JKgqEgVNf6QHdxfQyUoHKX1LIzEHHP922gXF4CHfBUo=',i1: 'ELCJBH9VvlX4qfweXzy+sQ==',i2: 'h6XvmDf0+dWC+B525v2HGw==',zh: '1uC7SxXC3GIQOWAtTAK1KExL3bvVcSt4ovp92qLhjPM=',uh: 'WIFn/maPG6jYGG12dVce7eo0wyX7m2D8aR+58ajaP8Y=',hh: 'ZlQPbT3Nn33Tbsv+744FEvrqmSDRgQc3QaN0HTwlp+4=',}};var cpo = document.createElement('script');cpo.src = '/cdn-cgi/challenge-platform/h/b/orchestrate/chl_page/v1?ray=845cd0df1c7f36dd';window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;if (window.history && window.history.replaceState) {var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;history.replaceState(null, null, "\/?__cf_chl_rt_tk=XRBE9FhqSdVynkPCsq1fSBA7vUGzLOmWdjZ6UbRAJ4s-1705308047-0-gaNycGzNCrs" + window._cf_chl_opt.cOgUHash);cpo.onload = function() {history.replaceState(null, null, ogU);}}document.getElementsByTagName('head')[0].appendChild(cpo);}());</script> } } `

@ThreshTheRed
Copy link
Author

We managed to apply a workaround where message sent to slack channel have no date in it.

In index.js we commented
Promise.all([ personio.getEvents(today)//, //dayOfTheYear.getToday(), ])

and in slack.js we changed
exports.sendPersonioEvents = (day, dayOfYear, events) => { const headerText = ""; const eventMessage = getEventsMessage(events); const fullMessage = ${eventMessage};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant