-
-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
@feathersjs/express^5 has a reused Symbol() across pkgs, but not actually equal #3071
Comments
Here's a link to an example repo: https://github.com/jamesvillarrubia/feathers_express_v5_symbol_issue |
Found a way around it:
But this feels wrong. I guess the expectation that two different imports would leverage the same runtime scope and share Symbols() seems ripe for a downstream issue. As an idea, would modification of the commons createSymbol to be globally scoped work better? feathers/packages/commons/src/index.ts Lines 98 to 100 in 4fbbfff
And then modify it to the following to use the global Symbol registry.
Or modifying the function to use a closure, such that the Symbol is created in the context of the originating scope and not the scope of the |
I didn't know that |
Steps to reproduce
Possible Root Cause
The error is caused by an empty
options
object here:feathers/packages/express/src/rest.ts
Lines 65 to 66 in 4fbbfff
This is returned by the
getServiceOptions
function, which is pretty straightforward:feathers/packages/feathers/src/service.ts
Lines 38 to 40 in 4fbbfff
It does a property check on the service for a SYMBOL('@feathersjs/service').
feathers/packages/feathers/src/service.ts
Line 5 in 4fbbfff
When I inspect in debugger, the data is there, but the SYMBOL is different from what was set as a property and what is being checked.
I've tried legacy bundling, but that didn't work either. I suspect that the SYMBOL is being created in different contexts, and therefore doesn't reference the same object. Seems like there's a dependency injection/inversion here from the express lib that could resolve this, but I don't fully understand the benefit of the SYMBOL usage.
Any guidance?
How this was discovered.
I'm trying to setup automated testing across multiple Feathers libraries that currently work in 4 and need to be extended to 5. Creating multiple branches for testing felt like an ugly solution since it would require a lot of pipeline revisions and tie the semVer of the library to the Feathers versions. I explored
npm overrides
,npm aliases
, andlegacy-bundling=true
to see if I could deduce the reason the SYMBOL was different in the express function.Expected behavior
Dove Express should return a normal response even when aliasing the libraries.
Actual behavior
Dove Express throws an error related to unreferenced SYMBOL
System configuration
Tell us about the applicable parts of your setup.
Module versions
@feathersjs/feathers@^5.0.0-pre.38
@feathersjs/express@^5.0.0-pre.38
NodeJS version:
Operating System:
Browser Version:
React Native Version:
Module Loader:
The text was updated successfully, but these errors were encountered: