silverstripe/silverstripe-elemental

Uncaught (in promise) Invariant Violation: An error occurred!

Opened this issue · 5 comments

Module version(s) affected

5.2.0-beta1, 5.1, 5.0

Description

After installing a fresh Silverstripe installation (using silverstripe/installer) and only adding dnadesign/silverstripe-elemental to the default Page object, when you add an element and publish the page, you get the following error:

Uncaught (in promise) Invariant Violation: An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#%7B%22version%22%3A%223.8.8%22%2C%22message%22%3A32%2C%22args%22%3A%5B%5D%7D

I originally thought it might be something in my project code caused by a misconfigured nginx setting, but I've now reproduced the error on a new install using Apache. It also appears to have been fixed a few times in the past: https://github.com/silverstripe/silverstripe-elemental/issues?q=invariant

How to reproduce

composer create-project silverstripe/installer ss52 5.2.0-beta1

---
Page:
  extensions:
    - DNADesign\Elemental\Extensions\ElementalPageExtension
---
  1. Setup the project using the details above. This was reproduced with the php:8.1-apache-jammy image, but also appears on nginx/fpm setups
  2. In Firefox 124, create a new Page
  3. Add a few Content blocks
  4. Publish the page

OBSERVE: the above error appears in the console

Possible Solution

No response

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)

This is a duplicate of #950 which I know you've seen, because you posted a link to filtered issues in slack. Please don't create duplicate issues.

In this case because this issue includes more information than the other one I'll close the other one, but in future please just include additional context in the existing issue.

Please also update the "How to reproduce" to include actual steps to reproduce the error - what do I do in the browser to see the error? Do I have to create a page? Create a block? Publish a block? etc etc etc.

Fair enough, the issue was 2 years old for SS4 though, and is impacting the publish button. I've added it here with fresh reproduction steps on SS5. Apologies for the duplicate

Just a note, the impact to the publish button is intermittent. I'm not able to reproduce it here, but may be more relevant when other elements are involved

is impacting the publish button

What do you mean by "impacting"? Does it set the button to disabled, for example?
And do you mean the page publish button, or the block publish button?

Last user report I had, an "error" Toast message appeared in the top right and publication did not actually occur. That was initially caused me to suspect an nginx problem. The page was stuck in a draft state afterwards. I'm still not entirely sure how to reproduce it myself. The console error here is specifically for default installs

RVXD commented

I see these errors too in console on multiple 5.2 sites using Elemental. Can the errors be suppressed/fixed somehow?