-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
subscriber's event function ctx with different structure #1070
Comments
Hi @lling1105 can you create a repro repo please? |
@AndreMaz this issue appeared when use webpack.js to build bundle.js, guess it's about the output setting: libraryTarget: 'commonjs2'. i changed to other kind target, but still the same |
solved! set webpack optimization.minimizer to none |
This seems like it's related to moleculer's support for two different function signatures for event handlers (see the 0.14 changelog). The code that determines which signature to use relies on the name of the parameter being Lines 32 to 34 in 422876c
Webpack (or any other) minimizer will usually change the parameter name, causing the function to be passed params for the old event handler signature. As the changelog notes, you can add |
Exactly. |
i have 2 clients subscribe the same event, when both receive the notice, one has ctx and can get the params correctlly, but the other one ctx is the params value, no params path, why?
both client service with the same codes,
#1 client event receiver:
ctx.params -> {"result":"ok"}
#2 client event receiver:
ctx -> {"result":"ok"} and no ctx.params
The text was updated successfully, but these errors were encountered: