Francismiko
Francismiko2y ago

About 'convex/server throws in browsers'

After I upgraded to version 0.15, just like the new features of the version update, I had an error like the one in the title, but I don't know how to effectively exclude the code I referenced irregularly in the front end. Any good suggestions?
6 Replies
ballingt
ballingt2y ago
What's the bundler you're using, is there a stack trace? This could be a false positive (some parts of convex/server are not dangerous to reference from the frontend) but regardless is worth tracking down. If you don't have a stack trace showing how the file is being imported (some dev servers won't show this) you could try deleting/commenting out portions of your application until the error goes away to find it.
Francismiko
FrancismikoOP2y ago
@ballingt After conducting an investigation with my colleagues, we found that a redundant reference to convex/server in the frontend code caused this error (even though it was not being used). However, the addition of this check is still very meaningful as it helps identify potential issues in future development. I believe it is necessary to keep this feature to mitigate any potential risks.
ballingt
ballingt2y ago
Great to hear you found the issue!
Francismiko
FrancismikoOP2y ago
The error in my project was indeed caused by this reference.
export * from '../../convex/_generated/server'
export * from '../../convex/_generated/server'
ballingt
ballingt2y ago
I agree this is a useful check, we may make it more targeted in the future: there are parts of 'convex/server' that are not dangerous to import in the client, but we want to ensure backend functions are never accidentally included.
Francismiko
FrancismikoOP2y ago
That is absolutely certain, and I hope that future checks in this regard can be further improved haha.

Did you find this page helpful?