-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
TypeError [ERR_INVALID_ARG_TYPE]: The "filename" argument must be of type string or an instance of URL. Received an instance of URL #11551
Comments
This could maybe be an error message from Also, can you please give us some information when you are getting this error? Is this during build or in the browser? |
There is a ton of affected files, which contents I also cant share. The error happens whenever a query runs. It might be worth to add that the queries are running in React Server Components, using Next 14 and app router. I get the error both on build time and runtime, but if I disable SWC support in next.config.js it only happens in runtime. |
The thing is, nothing in the whole source code of Apollo Client tries to access anything with a With just the error message, not even a stack trace and no other pointers, we can't really help you - you'll have to share more information with us for us to be able to look into this. Maybe you could at least share the stack trace and show us how you import |
I updated the issue description with the whole code of my Apollo Link. I'm using it in a Next 14 application with app router and the queries run in a server component. One other thing is that im using the experimental support lib and the link in the description is used with the registerApolloClient function:
|
Oh and of course the buildtime error (which I can work around by disabling swc support in next.config):
And the runtime error (which I still can't work around and names this issue)
|
import { registerApolloClient } from "@apollo/experimental-nextjs-app-support/rsc"
import client from "@src/lib/apolloClient"
export const { getClient } = registerApolloClient(() => client) Please never do that! It's extremely important that the |
This seems to be from further up the network chain - can you expand that error in your console, and log |
Regarding the client being shared, it is not an issue since this product is all about public content, there is no user data being transfered, but thanks for the tip! The network error is the same one I opend the issue with:
|
Also keep in mind that you might end up with outdated data if the server runs for a long time. We will likely add a console warning about this in the future.
Yes, but does that nested error have a stack trace that tells us where it's coming from? My guess is that it's somehwere from the Next.js |
This is not an issue rn because I'm running everything serverless. Concerning the error, I wasn't able to log all of it but now I got it
|
That looks like the "outer" stack, as in |
I guess you mean this?
|
Yes! It seems the For what it's worth, you don't need an external package for that, modern import crypto from "node:crypto";
function sha256(data: string) {
const hash = crypto.createHash("sha256");
hash.update(data);
return hash.digest("hex");
} |
I just had to change the import to Thank you very much! |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
Happy to help, I hope you can resolve your other problem, soon, too! I've also answered to your StackOverflow question - maybe the answer there helps someone else in the future :) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
I'm getting this very weird error trying to use Apollo persisted queries link, as instructed here, and I'm very confused of what it means, since if 'instance of URL' is a valid type and that function is receiving it like that, it shouldn't be a type error.
My client looks like this:
Link to Reproduction
.
Reproduction Steps
No response
@apollo/client
version3.9.1
The text was updated successfully, but these errors were encountered: