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

getUserByUsername() is getting error #286

Open
erhancan256 opened this issue Mar 19, 2022 · 2 comments
Open

getUserByUsername() is getting error #286

erhancan256 opened this issue Mar 19, 2022 · 2 comments

Comments

@erhancan256
Copy link

hello i using instagram-web-api last version

i using getUserByUsername() method and i get this error
(node:96495) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'user' of undefined
how can i fix ?

@adamwiw
Copy link

adamwiw commented Apr 15, 2022

I just started getting this message. It worked until I started blasting the api and running it over and over. Are you still getting the message? I don't know if they did something temporarily or I'm done.

  async getUserByUsername({ username }) {
    return this.request({
      uri: `/${username}/?__a=1`,
      headers: {
        referer: baseUrl + '/' + username + '/',
        'x-instagram-gis': await this._getGis(`/${username}/`)
      }
    }).then(data => data.graphql.user)
  }

When you debug into the then part you can see there's no data coming back. I can still access instagram through the web though so I wonder what they did.

@S-codes14
Copy link

hello i using instagram-web-api last version

i using getUserByUsername() method and i get this error (node:96495) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'user' of undefined how can i fix ?

also got the same problem this ins my solution:

const Instagram = require('instagram-web-api')
const { username, password } = process.env

const client = new Instagram({ username, password })

;(async () => {
  await client.login()
  const instagram = await client.getUserByUsername({ username: 'instagram' })

  console.log(instagram)
})()

I just had to read the document properly

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

3 participants