Open brandonmarino opened 4 years ago
:+1:
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.
let app = new EmberApp(defaults, {
'ember-fetch': {
preferNative: true
},
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: https://github.com/ember-cli/ember-fetch/issues/45#issuecomment-448689032Tested 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.