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

Error 400 no generic error #403

Closed
mrjackyliang opened this issue Apr 18, 2018 · 5 comments
Closed

Error 400 no generic error #403

mrjackyliang opened this issue Apr 18, 2018 · 5 comments

Comments

@mrjackyliang
Copy link

Overview

  • **Client ID:**jyHeS_MVualewtI_Ab4wHg
  • Issue type: question, bug
  • Summary: (A few sentences describing the issue and what you're trying to do)
  • Platform: react native/apollo client

Description

Trying to do a business search, but get's error 400 instead with no reason why.

Endpoint

Fusion Search API

Parameters or Sample Request

this.client = new ApolloClient({
	uri: 'https://api.yelp.com/v3/graphql',
	request: (operation) => {
		operation.setContext({
			headers: {
				Authorization: `Bearer ${API_KEY}`,
				"Content-Type": 'application/graphql',
			}
		})
	},
	cache: new InMemoryCache(),
});

Response

[Network error]: Error: Response not successful: Received status code 400

Extra information

Error information from remote js debugger (react native)

@teekwak
Copy link
Contributor

teekwak commented Apr 19, 2018

Hi there,

400 looks like maybe there is a typo somewhere in the request you are making. Can you upload the query you are making to our GraphQL endpoint?

@mrjackyliang
Copy link
Author

mrjackyliang commented Apr 19, 2018

This is the query we're making. We also tried it in a test, and that worked.

{
  search(location: "san francisco") {
    total
    business {
      name
    }
  }
}

@teekwak
Copy link
Contributor

teekwak commented Apr 20, 2018

Query looks good to me. Just tested myself as well via command-line.

I see that you are using React-Native. Correct me if I am wrong, but your code snippet seems to be creating the ApolloClient in a React component. If so, this will cause a CORS error when the ApolloClient makes the fetch request, which we do not currently support (see #64 for workarounds to this issue).

@mrjackyliang
Copy link
Author

How do we go forward with that?

@mrjackyliang
Copy link
Author

I found that the request isn’t being created inside a React component.

The component calls the function which the function loads the class via an instance.

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

No branches or pull requests

3 participants