-
Notifications
You must be signed in to change notification settings - Fork 187
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
Cannot read properties of null (reading '0') #302
Comments
having the same issue here.. |
I think the issue is with this code Doing a The way I got it to work was to replace escaped quotes with non-escaped ones, before matching the regex: await this.request('/', { resolveWithFullResponse: true }).then(res => {
const pattern = new RegExp(/(csrf_token":")\w+/)
const matches = res.toJSON().body.replace(/\\"/g, '"').match(pattern)
value = matches[0].substring(13)
}) |
i think the package is completely broken.. |
For my case, Instagram identify unusual login, when i follow the checkpoint URL, they required me to change my password before continue.. StatusCodeError: 400 - {"message":"checkpoint_required","checkpoint_url":"/challenge/action/AXEKy63B9j8ILsr8huijpQn9PEYOzBiY-5vpbN6PDFgowATNdyZrUX1VXivUQaLV-JTF/Afz24OgDEt9wmXbBpuUFsCytJ_mtvkP7OT3aYhJEtJZtsy0dtVT1_qlvE426vXD6vBgLMIO8u-OUVw/ffc_UEvY9OEISw45TL7Pr9Uu6ASkxGOMKWYGuv7xl3Jjodk40sV7IzWyJvaXH63VVOo1/","lock":false,"flow_render_type":0,"status":"fail"} |
++ |
(node:2668) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of null |
Dude 2 months still not solved |
i have same problem pls help |
I found a solution but theres another porblem Edit the package and replace the errored code with this let value = this.request('/', { resolveWithFullResponse: true }).then(res => { But another error apears |
just tried to use the moduile and hit this also
disappointing |
Facing the same issue. |
i made a fix, just replace this let value
await this.request('/', { resolveWithFullResponse: true }).then(res => {
const pattern = new RegExp(/(csrf_token":")\w+/)
const matches = res.toJSON().body.match(pattern)
value = matches[0].substring(13)
}) with this let value
await this.request('/', { resolveWithFullResponse: true }).then(res => {
const pattern = new RegExp(/(csrf_token\\":\\")\w+/)
const matches = res.toJSON().body.match(pattern)
if (!matches || matches.length === 0)
throw new Error('Missing CSRFToken')
value = matches[0].substring(15)
}) in the file lib/index.js line 53 |
but this creates a new error if u tried running it a request error |
can you give the error you got? |
const matches = res.toJSON().body.match(pattern)
value = matches[0].substring(13)
TypeError: Cannot read properties of null (reading '0')
node_modules\instagram-web-api\lib\index.js:57:22
The text was updated successfully, but these errors were encountered: