Skip to content
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

FS issue on Services detail pages #430

Closed
1 task done
namniak opened this issue Aug 31, 2023 · 3 comments
Closed
1 task done

FS issue on Services detail pages #430

namniak opened this issue Aug 31, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@namniak
Copy link

namniak commented Aug 31, 2023

Have you read the Contributing Guidelines on issues?

Description

There's an error when navigating to Service detail pages

error - ../node_modules/@asyncapi/parser/esm/from.js:10:0
Module not found: Can't resolve 'fs'

Steps to reproduce

Run

  • npx @eventcatalog/create-eventcatalog@latest my-catalog
  • cd my-catalog && npm run dev

go to http://localhost:3000/services/ and click one of the services or deeplink directly to http://localhost:3000/services/Data%20Lake/

Expected behavior

Service detail pages should show correctly similarly to events detail pages

Actual behavior

image image

Your environment

  • EventCatalog version used: latest
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 115 Node v16.15.1
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS 13.5
@namniak namniak added the bug Something isn't working label Aug 31, 2023
@gregtyler
Copy link

I ran into the same thing, which seems to be caused by dependencies requiring the Node module fs, which isn't available in the browser. @asyncapi/react-component is one of those and they discuss a similar issue (http not fs) here. Based on a StackOverflow answer I'm now patching EventCatalog's next.config.js to include extra config for Webpack:

webpack(config) {
  config.resolve.fallback = {
    ...config.resolve.fallback,
    fs: false,
  };
  return config;
},

This works for me, but I'm not familiar enough with Next.JS to know what the trade-offs are and there's likely a better solution.

@namniak
Copy link
Author

namniak commented Sep 6, 2023

Currently, we are patching internal .eventcatalog-core package.json from the main eventcatalog as it overwrites .eventcatalog-core every time npm run dev is executed.

Root eventcatalog package.json

"scripts": {
  "dev": "(sleep 5 && npm run patch:core) & eventcatalog dev",
  ...
  "patch:core": "cd .eventcatalog-core && npm pkg set 'browser'='{\"fs\":false,\"path\":false,\"os\":false}' --json"
}

Not sure if there's a better solution but it seems to work for now until https://github.com/boyney123/eventcatalog/pull/431 is merged

@boyney123
Copy link
Collaborator

Thanks for the patience , this is now fixed thanks to #431, I have also locked down the AsyncAPI react component (Which broke things), we can update that in future releases.

@eventcatalog/core version 1.0.2 is now out.

Try again, reopen the issue if we still have issues.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants