Search code examples
elasticsearchruntime-errorsulu

Sulu, strange hash related error when trying to save page / post?


Until recently everything was working well. Now, when I try to save (create or update) any page or post I get error message at top of the form "Error - There was an error when trying to save the form".

In error log I see this error:

“Uncaught PHP Exception Sulu\Component\Rest\Exception\InvalidHashException: “The given hash for the entity of type “Sulu\Bundle\ArticleBundle\Document\ArticleDocument” with the id “9e0720a7-5565-4a6f-a735-8a186b8fef9b” does not match the current hash. The entity has probably been edited in the mean time.” at /var/www/html/vendor/sulu/sulu/src/Sulu/Component/Hash/RequestHashChecker.php line 53"

Tried clearing symfony cache, website cache from admin, restarting docker containers.

I'm totally unaware that I did something to cause this error. Please help.

Update: strange thing I just noticed. When I try to save some article and I get that error and go back to overview page (where i.e. all articles of that type are listed) then I see unchanged article title. But when I click to edit it I see changed title?!? Like title on overview page and title on edit page are not used from the same place? How is that possible?

Update:

Now even I setup once more project from scratch saving articles causes that error. Some more info:

In stack trace last command executed is:

in vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php (line 64)

an it shoots out “No alive nodes found in your cluster”.

And while I'm setting up the project when executing:

php bin/console ongr:es:index:create

I get error:

{"error":{"root_cause":[{"type":"resource_already_exists_exception","reason  
  ":"index [su_articles/sWs5F1uzSFO8bFiZqF1Egw] already exists","index_uuid":  
  "sWs5F1uzSFO8bFiZqF1Egw","index":"su_articles"}],"type":"resource_already_e  
  xists_exception","reason":"index [su_articles/sWs5F1uzSFO8bFiZqF1Egw] alrea  
  dy exists","index_uuid":"sWs5F1uzSFO8bFiZqF1Egw","index":"su_articles"},"st  
  atus":400} 

And when I run:

php bin/console ongr:es:index:create --manager=live

I get similar:

In Connection.php line 675:
  {"error":{"root_cause":[{"type":"resource_already_exists_exception","reason":"index [su_articles_live/Pissm9ycRj-o79K4wrrD  
  AA] already exists","index_uuid":"Pissm9ycRj-o79K4wrrDAA","index":"su_articles_live"}],"type":"resource_already_exists_exc  
  eption","reason":"index [su_articles_live/Pissm9ycRj-o79K4wrrDAA] already exists","index_uuid":"Pissm9ycRj-o79K4wrrDAA","i  
  ndex":"su_articles_live"},"status":400} 

Also to mention that now saving pages works, but saving articles doesn't.


Solution

  • This solved the issue on ElasticSearch index creation for me:

    php bin/console ongr:es:index:drop --force