colibris-xyz / strapi-plugin-site-publisher

This is a plugin for Strapi headless CMS. It lets you trigger a GitHub Action workflow when the site is ready to be published.
MIT License
6 stars 3 forks source link

Uncaught promise on the admin screen of Strapi causing white screen #132

Closed grctprobst closed 7 months ago

grctprobst commented 8 months ago

Installed the plugin to help end users push content via the build process without the need of developers. I have had this plugin working on older versions of strapi but we recently updated to strapi version 4.20.1.

I just installed the plugin and am seeing this error in the console after installation. Removing the plugin returns the strapi dashboard to normal operation.

Was hoping someone may be able to provide some guidance. Please let me know if more information is needed. Thank you. Screen Shot 2024-02-16 at 3 43 01 PM

tms0 commented 8 months ago

Hi @grctprobst,

Which version of the plugin are you using ?

grctprobst commented 8 months ago

Hi @grctprobst,

Which version of the plugin are you using ?

I am using the newest version that was release a month ago or so, version 0.2.0 of the plugin.

grctprobst commented 8 months ago

Hey @tms0,

I did a little bit more debugging and here is what I found. It seems that inside /admin/src/index.js, pluginPkg was returning as undefined, I'm not sure why but a simple console.log(pluginPkg) before it is referenced seemed to remedy the white screen. (I have no idea why logging this out beforehand would have this behavior)

I did a bit more digging and I noticed when you register the plugin with Strapi you pass in an Initializer component that seems to set the values from Strapi's env file. I checked the docs for .registerPlugin() and I am not seeing any information on the initializer field. Could they have removed this by chance?

Haven't had much luck with anything else and not sure if this helps at all but I figured I would give it a try. Will continue to dissect in the coming days.

Thank you.

tms0 commented 8 months ago

Hi @grctprobst,

I managed to reproduce it, but I don't know why it crashes and how to fix it properly. I hope to fix it soon.

tms0 commented 8 months ago

Ok...

// Not working
const { name, displayName } = pluginPkg.strapi;

// Working
const name = pluginPkg.strapi.name;
const displayName = pluginPkg.strapi.displayName;

I don't get it, but anyway... it works ;-)

I will publish a fix next week (sorry, don't have the time to do it now).

grctprobst commented 7 months ago

@tms0 Much appreciated!

tms0 commented 7 months ago

Hi @grctprobst,

I just released a v0.2.1 with the fix.