asyncapi-react
asyncapi-react copied to clipboard
TypeError: message.id is not a function
Description
It looks like the latest changes from https://github.com/asyncapi/asyncapi-react/commit/eabba4fb52741b529e9b71a82dfd303cb56c69c1#diff-ab2dcbe79ad45d341a8591fc20c2b9896235a440f5465b1b8d165b8c733b9a32L62 have caused a breaking change.
When running npx asyncapi generate fromTemplate asyncapi.yml @asyncapi/html-template -o ./asyncapi --force-write
The following error is show:
TypeError: message.id is not a function
at C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\@asyncapi\react-component\src\containers\Sidebar\Sidebar.tsx:51:64
at Array.map (<anonymous>)
at Sidebar (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\@asyncapi\react-component\src\containers\Sidebar\Sidebar.tsx:44:35)
at processChild (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\react-dom\cjs\react-dom-server.node.development.js:3353:14)
at resolve (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\react-dom\cjs\react-dom-server.node.development.js:3270:5)
at ReactDOMServerRenderer.render (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\react-dom\cjs\react-dom-server.node.development.js:3753:22)
at ReactDOMServerRenderer.read (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\react-dom\cjs\react-dom-server.node.development.js:3690:29)
at Object.renderToString (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\react-dom\cjs\react-dom-server.node.development.js:4298:27)
at Context.renderSpec (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\@asyncapi\html-template\filters\all.js:165:25)
at eval (eval at _compile (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\nunjucks\src\environment.js:527:18), <anonymous>:38:97)
at Context.generateBase64Favicon (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\@asyncapi\html-template\filters\all.js:105:12)
at Template.root [as rootRenderFunc] (eval at _compile (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\nunjucks\src\environment.js:527:18), <anonymous>:21:40)
at Template.render (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\nunjucks\src\environment.js:454:10)
at Environment.renderString (C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\node_modules\nunjucks\src\environment.js:313:17)
at C:\Users\alan_\Work\Projects\craftsman-serverless-api\node_modules\@asyncapi\generator\lib\renderer\nunjucks.js:32:14
at new Promise (<anonymous>)
Expected result No error is thrown.
Actual result Error is being thrown and stops output.
Steps to reproduce
- Install the latest version of @asyncapi/cli
- Run the command
npx asyncapi generate fromTemplate asyncapi.yml @asyncapi/html-template -o ./asyncapi --force-write
Troubleshooting Tried installing a previous version of the package using the override option with my root package file but this does not seem to take.
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
We have been encountering the same error since today while using the Docker generator image.
I have found a way round this to force the @asyncapi/html-template to 0.20.0 before the @asyncapi/react-components next package is referenced.
npx asyncapi generate fromTemplate asyncapi.yml @asyncapi/[email protected] -o ./asyncapi --force-write
Duplicate of https://github.com/asyncapi/html-template/issues/438
If you personally integrate with this library and parse your AsyncAPI documents before passing them to the library (i.e. use the bundled component without the parser) make sure to use at least v3.0.0-next-major-spec.1 of the parser.
Should be fixed as of html-template v0.28.4
Thanks for the rapid fix @jonaslagoni !
@jonaslagoni not sure, but looks like similar problem after update to 49
log
[Error] TypeError: e.dependencies is not a function. (In 'e.dependencies()', 'e.dependencies' is undefined) — resources:32:1883716
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] TypeError: e.dependencies is not a function. (In 'e.dependencies()', 'e.dependencies' is undefined) — resources:32:1883716
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] TypeError: n.title is not a function. (In 'n.title()', 'n.title' is undefined) — resources:32:1909096
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] TypeError: n.title is not a function. (In 'n.title()', 'n.title' is undefined) — resources:32:1909096
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] TypeError: o.isSend is not a function. (In 'o.isSend()', 'o.isSend' is undefined) — resources:32:1916241
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] TypeError: r.variables is not a function. (In 'r.variables()', 'r.variables' is undefined) — resources:32:1896546
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] TypeError: r.variables is not a function. (In 'r.variables()', 'r.variables' is undefined) — resources:32:1896546
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] TypeError: r.id is not a function. (In 'r.id()', 'r.id' is undefined) — resources:32:1826892
ia (resources:32:539997)
(anonymous function) (resources:32:546718)
mo (resources:32:506203)
pa (resources:32:541312)
Sc (resources:32:558539)
Sc
(anonymous function) (resources:32:591182)
xc (resources:32:555198)
fc (resources:32:551503)
fc
(anonymous function) (resources:32:502963)
(anonymous function) (resources:32:591182)
Ji (resources:32:502909)
Wi (resources:32:502844)
cc (resources:32:548073)
enqueueSetState (resources:32:506627)
(anonymous function) (resources:32:575238)
(anonymous function) (resources:32:1992597)
(anonymous function) (resources:32:1991408)
s (resources:32:1990250)
[Error] Unhandled Promise Rejection: TypeError: e.dependencies is not a function. (In 'e.dependencies()', 'e.dependencies' is undefined)
(anonymous function) (resources:32:1991469)
s (resources:32:1990250)
[Error] WebSocket connection to 'ws://localhost:63343/jb-server-page?reloadMode=RELOAD_ON_SAVE&referrer=%2Fasyncapi%2Frender' failed: The operation couldn’t be completed. Socket is not connected
component configuration after template was composed:
<html>
<head>
<!-- <link rel="stylesheet" href="https://unpkg.com/@asyncapi/[email protected]/styles/default.min.css">-->
<link rel="stylesheet" href="http://localhost:63343/asyncapi/resources?resourceUrl=default(1.0.0-next.49).min.css">
</head>
<body>
<div id="asyncapi"></div>
<!-- <script src="https://unpkg.com/@asyncapi/[email protected]/browser/standalone/index.js"></script>-->
<script src="http://localhost:63343/asyncapi/resources?resourceUrl=index(1.0.0-next.49).js"></script>
<script>
AsyncApiStandalone.render({
schema: {
url: 'http://localhost:63343/asyncapi/resources?schemaUrl=/private/var/folders/bb/zdnfkz2126s5xcrc57n0j2tw0000gn/T/jasyncapi-idea-plugin-1693522102721.yaml',
options: {method: "GET", mode: "cors"},
},
config: {
show: {
sidebar: true,
}
},
}, document.getElementById('asyncapi'));
</script>
<!-- WebSocket connection listening for reload message -->
<script>
// WebSocket
</script>
</body>
</html>
Similar problem yea, just not related to html template 😄
I should have a fix soon 😅
The same here,
Error occurs with .lock update to 3.0.0-next-major-spec.2
Using nestjs-asyncapi
integration
TypeError: message.id is not a function
Should be fixed with the recent version, can you check if it still occurs?
Should be fixed with the recent version, can you check if it still occurs?
Renders as expected test specs. I checked rendering on [email protected]/
and [email protected]/
Is it ok, that in new versions of component I see blank page instead of errors?
@Pakisan please create a new bug report 😄 Most likely error is that the plugin is using a wrong parser dependency version. But might be something else, dont know the context
This issue has been automatically marked as stale because it has not had recent activity :sleeping:
It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
Thank you for your patience :heart:
seems to be fixed
please create a new issue if not, with results of error using latest react component