RSC-Labs / medusa-documents

Medusa plugin which generates documents (e.g. invoices) in PDF
MIT License
43 stars 5 forks source link

Admin Runtime Error on Clicking Templates Tab: Invalid Element Type #1

Closed KabyleBOT closed 3 months ago

KabyleBOT commented 5 months ago

Description

When clicking on the "Templates" tab in the development environment, a runtime error occurs, indicating an issue with an invalid element type. This error suggests a potential problem with how a component is imported or exported.

Error Message

Uncaught runtime errors:
×
ERROR
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `at`.
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `at`.
    at pa (http://localhost:7001/main.bundle.js:496:174113)
    at ps (http://localhost:7001/main.bundle.js:496:174400)
    at http://localhost:7001/main.bundle.js:496:59872
    at s (http://localhost:7001/main.bundle.js:496:59923)
    at cL (http://localhost:7001/main.bundle.js:496:90793)
    at c9 (http://localhost:7001/main.bundle.js:496:112159)
    at HTMLUnknownElement.g (http://localhost:7001/main.bundle.js:484:48294)
    at Object.r1 (http://localhost:7001/main.bundle.js:484:48619)
    at r7 (http://localhost:7001/main.bundle.js:484:49572)
    at ef (http://localhost:7001/main.bundle.js:496:169867)
ERROR
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `at`.
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `at`.
    at pa (http://localhost:7001/main.bundle.js:496:174113)
    at ps (http://localhost:7001/main.bundle.js:496:174400)
    at http://localhost:7001/main.bundle.js:496:59872
    at s (http://localhost:7001/main.bundle.js:496:59923)
    at cL (http://localhost:7001/main.bundle.js:496:90793)
    at c9 (http://localhost:7001/main.bundle.js:496:112159)
    at HTMLUnknownElement.g (http://localhost:7001/main.bundle.js:484:48294)
    at Object.r1 (http://localhost:7001/main.bundle.js:484:48619)
    at r7 (http://localhost:7001/main.bundle.js:484:49572)
    at ef (http://localhost:7001/main.bundle.js:496:169867)

Steps to Reproduce

  1. Start the application in the development environment.
  2. Click on the "Templates" tab.
  3. The mentioned runtime error appears in the console.

Expected Behavior

Clicking on the "Templates" tab should display the templates without triggering any runtime errors.

Actual Behavior

A runtime error occurs, preventing the "Templates" tab from functioning as expected.

Environment

"@medusajs/admin": "^7.1.10" "@medusajs/medusa": "^1.20.0" "@rsc-labs/medusa-documents": "^0.3.1"

Thank you for your attention to this matter.

radoslaw-sz commented 5 months ago

hi @KabyleBOT - thanks for raising this issue. I am afraid it won't be an easy bug, as it works properly on my side, so I need make some deep analysis. I would need maybe more information 1) Does this error cause that Template tab does not work completely? Or it is just a warning? Do you see any components rendered or the whole content of tab is broken? 2) Did you try maybe set settings in Settings tab (like address etc.) and then jump back to Template tab? Is error appearing then? This knowledge would help to narrow down the problem.

KabyleBOT commented 5 months ago

Thank you for your response.

We were testing in dev mode and the templates tab throws a run time error not only warning.

We tried fill settings which worked fine, but the templates tab keeped throwing the error.

I think it's something related to admin Ui, a component import not working correctly.

radoslaw-sz commented 5 months ago

hi @KabyleBOT - thanks for the explanation. Could you please also point which part of this page is not being rendered? For instance do you see this "Preview is based on the last order" and other parts? Or all components are not rendered? this would help me to narrow down the problem. image

KabyleBOT commented 5 months ago

Hi,

The error is thrown just after clicking on template tab. The whole page is covered by the error in dev mode.

radoslaw-sz commented 5 months ago

thanks, I will try to reproduce it, I will keep you informed :)

radoslaw-sz commented 4 months ago

hi @KabyleBOT - I do not have a good news - I still cannot reproduce this issue, so also I cannot find where the problem might be.. However, I have noticed that very similar problem was raised in other of my plugins and the author was able to solve it by totally cleaning up the environment. Please take a look here: https://github.com/RSC-Labs/medusa-store-analytics/issues/5#issuecomment-2016757063 - maybe if you could follow these steps the issue will go away.

radoslaw-sz commented 3 months ago

hi @KabyleBOT - are you still experiencing this issue? I have plan to close this issue due to inactivity.

radoslaw-sz commented 3 months ago

hi @KabyleBOT - I am closing this issue due to inactivity. If you still experience this issue, feel free to reopen it.