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

Package missing error after install. #1065

Closed
NeutronScott12 opened this issue Oct 8, 2021 · 13 comments
Closed

Package missing error after install. #1065

NeutronScott12 opened this issue Oct 8, 2021 · 13 comments

Comments

@NeutronScott12
Copy link

I've been getting this error for some reason -

The "@apollo/federation/dist/directives" package is missing. Please, make sure to install this library ($ npm install @apollo/federation/dist/directives) to take advantage of SchemaBuilder

@abernix
Copy link
Member

abernix commented Oct 8, 2021

Are you directly importing @apollo/federation/dist/directives yourself? Where are you getting this error message from? This appears to be some tooling error? Is there any more to the error message that just that?

If you were directly depending on @apollo/federation/dist/directives (which is not a top-level dependency and is not a public API) then you'll have to update your dependency to use the new @apollo/subgraph package since the directives module has been moved into that new package and away from@apollo/federation as of the latest version.

@NeutronScott12
Copy link
Author

I am using Nestjs while using their Graphql module, I have left them a bug report as well, I've checked node_modules and yes the error message is correct there's no directives file.

Here's the repo - https://github.com/OGNeutron/TheLastHurrah/tree/master/packages/the-last-hurrah-commence

@abernix
Copy link
Member

abernix commented Oct 8, 2021

The file is definitely gone, so the error message is correct. My point is that we didn't expect anyone to depend on it externally from the project, as it's not exported from the top-level of the package. 😉

If someone is — that's okay though it'd be good to understand the use-cases, so we can discuss if we want to expose it at the top-level of the package or not! In the meanwhile, the dependency should be updated to point to @apollo/subgraph which is taking the place of @apollo/federation and will provide precisely the pieces of Federation (which includes more than just subgraphs, but also the Router/Gateway, various tooling, etc.) for Subgraph servers to allow their schema to participate in a federated architecture (rather than also including all of our composition algorithm itself, etc. – which will soon get their own dedicated packages)

That module is now available at @apollo/subgraph/dist/directives in the published npm package.

@abernix
Copy link
Member

abernix commented Oct 8, 2021

I responded on https://github.com/nestjs/nest/issues/8264 and linked it to this issue for others who encounter this. This will need to be fixed in NestJS though!

@NeutronScott12
Copy link
Author

Odd, I don't think I changed anything, I had a problem with Prisma JS so I re-installed all the node_modules in the workspace fixed that problem then this random problem popped up, so someone has changed something.

I agree it's probably on Nestjs end which I have left messages on their Discord and Github, just waiting for them to respond, I am guessing it's just a change they made.

Thanks for the help.

@abernix
Copy link
Member

abernix commented Oct 8, 2021

To be clear: Something has changed. It isn't something they have changed, but rather something we changed. However, the thing we changed isn't something another external project was meant to be depending on. Because they did depend on it (a deeply nested module; a function that is not part of our public API) — now they need to make a change. I don't know much about how NestJs works, but I'm assuming that after they fix things, you should be all set again without making any changes. 😄

@abernix
Copy link
Member

abernix commented Oct 19, 2021

This is being resolved in nestjs/graphql#1797 (and follow-ups)

@abernix abernix closed this as completed Oct 19, 2021
@iMobs
Copy link

iMobs commented Oct 20, 2021

@abernix for future reference, since @apollo/subgraph/dist/directives isn't part of the root export is it safe to use? Should it be added to the exports or given a more explicit entrypoint like @apollo/subgraph/directives?

@abernix
Copy link
Member

abernix commented Oct 26, 2021

@iMobs It seems plausible to me! You should be fine for the short-term, but can you elaborate on the use-cases so we can talk about them explicitly and make sure we make the right choice? Thanks!

@iMobs
Copy link

iMobs commented Nov 24, 2021

@abernix it's already had a breaking change to the export thanks to #1096 renaming federationDirectives to directivesWithNoDefinitionNeeded. NestJS has a fix but might need a more major rewrite to not use the directives directly.

@trevor-scheer
Copy link
Member

@iMobs happy to discuss possibly exporting these directives as part of the public API. Would you mind opening an issue (or a PR, even) which states your use case for them?

@alondon17
Copy link

@trevor-scheer type-graphql's example federation project uses this to make a schema https://github.com/MichalLytek/type-graphql/blob/master/examples/apollo-federation/helpers/buildFederatedSchema.ts
me and maybe other people copied that, and it broke when updating dependencies

@iMobs
Copy link

iMobs commented Jan 24, 2022

Looks like the owner of NestJS has done a major refactor and referencing the directives is no longer an issue. AFAIK this was a fork of type-graphql and I'm not sure how much they learn from each other these days but a similar fix would probably be a good idea.

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

5 participants