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

Right-hand side of 'instanceof' is not an Object #693

Closed
2 tasks done
oknoorap opened this issue Jan 11, 2019 · 7 comments
Closed
2 tasks done

Right-hand side of 'instanceof' is not an Object #693

oknoorap opened this issue Jan 11, 2019 · 7 comments

Comments

@oknoorap
Copy link

oknoorap commented Jan 11, 2019

Describe the bug

  • Node.js version: 10.12.0
  • OS & version: Linux 4.13.0-41-generic 46~16.04.1-Ubuntu SMP Thu May 3 10:06:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I'm using CRA (Create React App) version 2, customized-cra, and mobx, when I try to run simple code, I got an error.

Actual behavior

Uncaught (in promise) TypeError: Right-hand side of 'instanceof' is not an object
    at normalize (normalize-arguments.js:188)
    at got (create.js:37)

Expected behavior

Should return html body.

Code to reproduce

codesandbox: https://codesandbox.io/s/n4q68m36ll

code:

try {
      console.log(this.resturl.spinnerList)
      const response = await got('sindresorhus.com')
      console.log(response.body)
    } catch (error) {
      console.log(error)
    }
  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
@szmarczak
Copy link
Collaborator

TypeError: Right-hand side of 'instanceof' is not an object
    at normalize (node_modules/got/source/normalize-arguments.js:137:68)
    at got (node_modules/got/source/create.js:32:28)

if (is.nonEmptyString(query) || is.nonEmptyObject(query) || query instanceof URLSearchParams) {

@szmarczak
Copy link
Collaborator

I ran require('url').URLSearchParams in the sandbox. It gives undefined. On my local machine it works perfectly.

@oknoorap
Copy link
Author

oknoorap commented Jan 11, 2019

@szmarczak
I'm not running my code in the codesandbox, but also in my local machine too.I just put an example link in order to add a working project example (not just code / screenshot).

So, please reopen this issue.

@szmarczak
Copy link
Collaborator

@oknoorap You're running it through webpack. As metioned in the documentation, Got doesn't support browsers.

@oknoorap
Copy link
Author

@szmarczak okay i see. thank you.

@rohmanhm
Copy link

https://github.com/sindresorhus/ky is a good alternative for browsers

@oknoorap
Copy link
Author

@rohmanhm thanks dude..

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