profusion / apollo-federation-file-upload

Add file upload support to Apollo Federated services.
32 stars 27 forks source link

this.fetcher is not a function #22

Closed doanthai closed 3 years ago

doanthai commented 3 years ago

When I upload file, a error occur below: this.fetcher is not a function I see fetcher function don't existed in your code. That may be fetch function of core javascript. Please fix it.

cabelitos commented 3 years ago

Hello @doanthai,

thank you for the report. However it's kinda difficult to know what's going on without a reproducible example.

Are you using apollo-server standalone ? which are your package versions?

If possible, could you please provide one?

At least on our automated tests everything is working fine.

Thank you

yuregl commented 3 years ago

Hello @cabelitos , I'm having the same problems. I'm using standalone, the version of profusion is this "@ profusion / apollo-federation-upload": "^ 2.2.1" and the error you are generating is this: "TypeError: this.fetcher is not a function", "at FileUploadDataSource. (/app/node_modules/@profusion/apollo-federation-upload/build/FileUploadDataSource.js:148:43)", "at Generator.next ()", "at fulfilled (/app/node_modules/@profusion/apollo-federation-upload/build/FileUploadDataSource.js:53:58)", "at process._tickCallback (internal / process / next_tick.js: 68: 7)"

[Edit]: When checking the RemoteGraphQLDataSource so that I could create mine because of the problem that is appearing, I saw that it has a fetch from a package. import {fetch} from 'apollo-server-env. So I installed the same in your implementation and made the substitution from httpResponse = yield this.fetcher(httpRequest) to httpResponse = yield fetch(httpRequest). And to my delight it worked.

cabelitos commented 3 years ago

I'll take a look. ty for the report.

cabelitos commented 3 years ago

@yuregl keep in mind that the fetcher function for apollo-gateway was introduced in recent versions. What version are you using for @apollo/gateway ?

yuregl commented 3 years ago

@cabelitos The version I'm currently using is "@apollo/gateway": "^0.16.0".

cabelitos commented 3 years ago

@yuregl Bingo, this is the problem. You should use at least "@apollo/gateway": "^0.24.4" . I bet npm/yarn display a bunch of warnings about peerDependencies that were not met.

cabelitos commented 3 years ago

I'm closing this, since @yuregl is using an outdated version of @apollo/gateway.