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

Could not resolve "@apollo/usage-reporting-protobuf" #7159

Closed
gersongams opened this issue Nov 17, 2022 · 14 comments
Closed

Could not resolve "@apollo/usage-reporting-protobuf" #7159

gersongams opened this issue Nov 17, 2022 · 14 comments

Comments

@gersongams
Copy link

I'm having issues with this version of apollo, I followed this docs

Version:
"@apollo/server": "^4.1.1",
"@as-integrations/aws-lambda": "^1.0.1",

image

@gersongams
Copy link
Author

@glasser not sure if this is related to #6057

@glasser
Copy link
Member

glasser commented Nov 17, 2022

We'll need more details in order to reproduce this: a full set of instructions that lets us see it on our machine. (Perhaps starting with git clone.) I think the details will depend on precisely what packages ended up in your package-lock.json, and might depend on the serverless tool you're using?

The line of code from @apollo/utils.usagereporting shouldn't have shown up until v1.0.1, which correctly has a dependency on @apollo/usage-reporting-protobuf, so this should work. Happy to reopen if you can provide full reproduction details.

@glasser glasser closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2022
@gersongams
Copy link
Author

I have a small example here https://github.com/gersongams/apollo-serverless-boilerplate

@gersongams
Copy link
Author

not sure if its because of the esbuild bundle

@glasser
Copy link
Member

glasser commented Nov 17, 2022

@gersongams What commands should I run after cloning? Ideally one that doesn't require setting up AWS credentials?

@glasser
Copy link
Member

glasser commented Nov 17, 2022

I am not a serverless expert but npm i && npx sls package ran successfully (and put something in .serverless/graphql.zip which contains a src/functions/graphql/handler.js that appears to have stuff from @apollo/usage-reporting-protobuf inside it).

@tobiasdiez
Copy link
Contributor

tobiasdiez commented Mar 3, 2023

I hit this (or a very similar issue) now as well during the upgrade from 4.3.2 to 4.4.1:

[Error] An error occurred during Apollo Server startup. All GraphQL requests will now fail. The startup error was: Cannot find package '@apollo/usage-reporting-protobuf' imported from C:\home\site\wwwroot\functions\node_modules@apollo\server\dist\esm\plugin\inlineTrace\index.js

Sadly, at the moment I can only reproduce it in the deploy environment (Azure functions), see JabRef/JabRefOnline#1803.

Maybe a result of #7411 @trevor-scheer ? In fact downgrading to 4.4.0 solved this problem.

@trevor-scheer
Copy link
Member

Thanks for reporting @tobiasdiez, I'll investigate this morning.

@trevor-scheer
Copy link
Member

trevor-scheer commented Mar 3, 2023

@tobiasdiez that error message looks a little strange to me, is there a reasonable explanation for the missing slash in the file path (between node_modules and @apollo)?

C:\home\site\wwwroot\functions\node_modules@apollo\server\dist\esm\plugin\inlineTrace\index.js

Edit: nvm, I inspected the source of the comment and it's escaping the @ 🤦

@trevor-scheer
Copy link
Member

@tobiasdiez where can I see that error? I found a similar error in the logs on the PR you linked, but it wasn't the same and it didn't point to any module resolution error.
https://github.com/JabRef/JabRefOnline/actions/runs/4323764421/jobs/7547748375

I know you said you don't have a reproduction right now. I tried to reproduce in a simple project and couldn't. If you do get a chance to investigate a bit further that would be helpful - I'm not sure how to be helpful at this point. I've also looked at the published packages and nothing seems obviously off.

@tobiasdiez
Copy link
Contributor

Thanks @trevor-scheer for having a look at this. Yes, the logs are containing only the public-facing error message, which hides all the details. The full error is only visible in the azure log console.

I'll try to reproduce it locally, without the deployment to azure. Do you have any idea where this error is coming from?

@trevor-scheer
Copy link
Member

@tobiasdiez if you can take a look into the dependency tree / lockfile that might be helpful, after that I'm really not sure.

npm ls @apollo/usage-reporting-protobuf (or its equivalent in your package manager) could be helpful.

@tobiasdiez
Copy link
Contributor

I tried to reproduce it locally, but strangely enough it is working even in azure's local emulator. But your idea with the dependency tree was right. Before I had

   └─ @apollo/server@npm:4.4.1 [43e07] (via npm:^4.4.1 [43e07])
      ├─ @apollo/usage-reporting-protobuf@npm:4.1.0 (via npm:^4.1.0)
      ├─ @apollo/server-gateway-interface@npm:1.1.0 [396ad] (via npm:^1.1.0 [396ad])
      │  └─ @apollo/usage-reporting-protobuf@npm:4.0.2 (via npm:^4.0.0)
      └─ @apollo/utils.usagereporting@npm:2.0.0 [396ad] (via npm:^2.0.0 [396ad])
         └─ @apollo/usage-reporting-protobuf@npm:4.0.2 (via npm:^4.0.0)

(note the two different versions of protobuf), which after yarn dedup resulted in

@apollo/server@npm:4.4.1 [43e07] (via npm:^4.4.1 [43e07])
      ├─ @apollo/usage-reporting-protobuf@npm:4.1.0 (via npm:^4.1.0)
      ├─ @apollo/server-gateway-interface@npm:1.1.0 [396ad] (via npm:^1.1.0 [396ad])
      │  └─ @apollo/usage-reporting-protobuf@npm:4.1.0 (via npm:^4.0.0)
      └─ @apollo/utils.usagereporting@npm:2.0.0 [396ad] (via npm:^2.0.0 [396ad])
         └─ @apollo/usage-reporting-protobuf@npm:4.1.0 (via npm:^4.0.0)

Which now worked. Yeah! 🥳 Thanks for your help!

@trevor-scheer
Copy link
Member

Glad that worked!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants