novu icon indicating copy to clipboard operation
novu copied to clipboard

🐛 Bug Report: notification center attempts to include child_process, fs, etc.

Open qw-in opened this issue 2 years ago • 10 comments

📜 Description

Module "child_process" has been externalized for browser compatibility. Cannot access "child_process.spawn" in client code.

This appears to be due to the reliance on axios which does not support esm (or at least known issues with vite).

Ref: https://github.com/vitejs/vite/issues/174, https://github.com/vitejs/vite/issues/184, etc.

Please consider using fetch instead.

👟 Reproduction steps

  1. Use vite (ts react)
  2. import { NovuProvider } from "@novu/notification-center";
  3. There ya go

👍 Expected behavior

Probably want it to work with vite.

👎 Actual Behavior with Screenshots

Crashes entire app.

💻 Operating system

Linux

🤖 Node Version

16

📃 Provide any additional context for the Bug.

Technically running via Tauri, but I don't think relevant to the bug

👀 Have you spent some time to check if this bug has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

qw-in avatar Sep 03 '22 01:09 qw-in

Hey there, I'd like to work on this issue. Can you assign it to me please?

AlexVCS avatar Sep 12 '22 12:09 AlexVCS

@AlexVCS , I've assigned you 🚀 , let me know if you need any help

BiswaViraj avatar Sep 13 '22 07:09 BiswaViraj

@AlexVCS did you had a time to look at this? LEt me know if I should un-assign you perhaps someone else will be able to take a look at this 🙏♥️

scopsy avatar Nov 27 '22 13:11 scopsy

Hey @scopsy sorry for the delay! I'd still like to try and work on this, thanks

AlexVCS avatar Nov 28 '22 13:11 AlexVCS

I tried recreating this issue. I made a Vite TS React project, installed and included import { NovuProvider } from "@novu/notification-center";

The app seems to run just fine with no crashing or errors. @qw-in are you still having this issue?

AlexVCS avatar Nov 28 '22 14:11 AlexVCS

I am on a Mac and not Linux, for the record.

AlexVCS avatar Nov 28 '22 14:11 AlexVCS

@AlexVCS maybe it's only a warning and not an actual error? Perhaps during build time or in the console of the web project?

scopsy avatar Nov 29 '22 07:11 scopsy

Good point @scopsy. From what I've looked at so far it seems like the error occurs during build time.

AlexVCS avatar Nov 29 '22 18:11 AlexVCS

I tried recreating this issue. I made a Vite TS React project, installed and included import { NovuProvider } from "@novu/notification-center";

The app seems to run just fine with no crashing or errors. @qw-in are you still having this issue?

Unfortunately I am no longer working on the project I was at the time. If no one else can reproduce I'd say probably safe to conclude this issue is fixed. Thanks!

qw-in avatar Nov 29 '22 23:11 qw-in

It seems that this error keeps happening, but in my tests it only occurred when I put NovuProvider tag. In my case, the error appeared in the console and not in build time!

Plactom avatar Dec 13 '22 13:12 Plactom

I tried recreating this issue. I made a Vite TS React project, installed and included import { NovuProvider } from "@novu/notification-center";

The app seems to run just fine with no crashing or errors. @qw-in are you still having this issue?

Same here.

@Plactom could you please state the version of Vite you used. Also it would be helpful to also share your package.json and vite.config.ts along with any additional snippets or info you think might be relevant.

gitstart-novu avatar Feb 14 '23 12:02 gitstart-novu

@scopsy based on this comment by one of the Vite maintainers, do you think it's worth it to just go ahead and migrate from using Axios to fetch?

Update: We could also retain axios but then use snowpack to convert.

gitstart-novu avatar Feb 16 '23 13:02 gitstart-novu

@gitstart-novu would be great if we can use axios for now and just fix the warning.

scopsy avatar Feb 16 '23 14:02 scopsy

Hi @scopsy still unable to reproduce the issue. Note that it was tried on different versions of Vite starting from 2.x.

gitstart-novu avatar Feb 17 '23 13:02 gitstart-novu

@scopsy Having not been able to reproduce the issue, do you think it's safe to close this issue as fixed?

gitstart-novu avatar Feb 23 '23 11:02 gitstart-novu

Yes we can close this, can be reopened again if needed 🙏

scopsy avatar Feb 23 '23 14:02 scopsy