-
Notifications
You must be signed in to change notification settings - Fork 72
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
ember-fetch polyfill causing error with default settings #366
Labels
Comments
👍 Does anyone have thoughts on this? |
This is interesting. Assuming you are doing the prefer native option, I think you would need to overwrite the default link options to pass a different fetch. It would look something like this: import ApolloService from 'ember-apollo-client/services/apollo';
import { createHttpLink } from '@apollo/client/core';
import { isPresent } from '@ember/utils';
class OverriddenApolloService extends ApolloService {
link() {
const { apiURL, requestCredentials } = this.options;
const linkOptions = { uri: apiURL, fetch };
if (isPresent(requestCredentials)) {
linkOptions.credentials = requestCredentials;
}
return createHttpLink(linkOptions);
}
} Let me know if this helps. |
If anyone ends up here because of the above error, adding this to your ember-cli-build.js file will fix it.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there!
Following the base configuration guide in the readme with a vanilla ember octane project leads to the following error:
We narrowed the cause down to
ember-fetch
. We found this closed issue on their git being discussed with a solution: ember-cli/ember-fetch#45 (comment)Tested that solution with our project and it's working.
So, from what I can gather, the issue either exists within
ember-fetch
OR with howember-apollo-client
configuresember-fetch
. Or perhaps this is just a case of a missing step in the docs.The text was updated successfully, but these errors were encountered: