Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstall islandora & views for make local #213

Merged
merged 7 commits into from
Jun 15, 2022
Merged

Conversation

DonRichards
Copy link
Member

@DonRichards DonRichards commented Jan 14, 2022

This may need some refinement but after a lot of testing I notices disabling then re-enabling the views with a module reinstall fixed the issue. It seems to have fix the issues described in #212
and #136

What changed

Added a make command to fix issue and a custom script that will only fix the issue if it's actually the issue.

To test (make local only)

Assuming you've ran make clean followed by make local but not have triggered the error yet. If you have either run the previous steps (to check the skip works) or just skip to step #4.

  1. Run make fix_views and it will try to copy the file into the container, run it and remove the script.
  2. Try making creating a basic page
  3. Should see error message
  4. Run steps 1 & 2 again
  5. No more error message

What just happened

Before attempting to make a page there was no error triggered. In the shell script is a check to look for a specific error. This way the fix is only applied when it absolutely will address the issue.

  • It installs Drupal Console
  • It runs Drupal console commands to re-enable all of the views one by one
  • Installs devel
  • Runs Devel's reinstall on the Islandora module
  • Rebuilds caches and node access
  • Runs drush cron
  • Then removes the patch_views.sh shell file from container.

Other issues addressed

Wasn't sure the impact of the missing config/sync directory and the masonry errors. So to eliminate those as compounding factors I addressed them in this PR as well as the "flysystem module is missing" errors. Some part of the build process is expecting it.

@DonRichards DonRichards changed the title Draft: Reinstall islandora & views for make local Reinstall islandora & views for make local Jan 14, 2022
@DonRichards DonRichards added bug Something isn't working enhancement New feature or request labels Jan 14, 2022
@kspurgin
Copy link

On step 5 above, I'm still getting the error.

Both times I run make fix_view it says:

[success] Cache rebuild complete.

The error from logs before triggering the error and running make fix_view a second time:

drupal_1      | 2022/01/18 16:32:51 [error] 1029#1029: *18 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception InvalidArgumentException: "A valid cache entry key is required. Use getAll() to get all table data." at /var/www/drupal/web/core/modules/views/src/ViewsData.php line 140" while reading response header from upstream, client: 192.168.112.18, server: drupal, request: "GET /node/1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm7/php-fpm7.sock:", host: "islandora.traefik.me", referrer: "https://islandora.traefik.me/admin/content"

The error from logs after running make fix_view a second time and creating a second basic page node:

drupal_1      | 2022/01/18 16:33:56 [error] 1027#1027: *14 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception InvalidArgumentException: "A valid cache entry key is required. Use getAll() to get all table data." at /var/www/drupal/web/core/modules/views/src/ViewsData.php line 140" while reading response header from upstream, client: 192.168.112.18, server: drupal, request: "GET /node/2 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm7/php-fpm7.sock:", host: "islandora.traefik.me", referrer: "https://islandora.traefik.me/node/add/page"

@kspurgin
Copy link

No idea if this is related to why it didn't work, but this is what I got with my terminal taking up half my screen vertically:

bash-5.1# drush watchdog:show --severity=Error | grep 'cron\|php' | grep 'A valid cache entry key is required' | awk '{print $6}'
bash-5.1# drush watchdog:show --severity=Error
 ---- -------------- ----------- ---------- --------------------------------------------------------
  ID   Date           Type        Severity   Message
 ---- -------------- ----------- ---------- --------------------------------------------------------
  61   18/Jan 16:33   php         Error      InvalidArgumentException: A valid cache entry key is
                                             required. Use getAll() to get all table data. in
                                             Drupal\views\ViewsData->get() (line 140 of
                                             /var/www/drupal/web/core/modules/views/src/
  58   18/Jan 16:32   php         Error      InvalidArgumentException: A valid cache entry key is
                                             required. Use getAll() to get all table data. in
                                             Drupal\views\ViewsData->get() (line 140 of
                                             /var/www/drupal/web/core/modules/views/src/
  56   18/Jan 16:32   flysystem   Error      http://islandora.traefik.me:8081/fcrepo/rest/ returned
                                             404
  55   18/Jan 16:32   php         Error      InvalidArgumentException: A valid cache entry key is
                                             required. Use getAll() to get all table data. in
                                             Drupal\views\ViewsData->get() (line 140 of
                                             /var/www/drupal/web/core/modules/views/src/
  51   18/Jan 16:31   flysystem   Error      http://islandora.traefik.me:8081/fcrepo/rest/ returned
                                             404
  50   18/Jan 16:02   flysystem   Error      http://islandora.traefik.me:8081/fcrepo/rest/ returned
                                             404
  37   18/Jan 16:01   flysystem   Error      The Flysystem driver is missing.
 ---- -------------- ----------- ---------- --------------------------------------------------------
bash-5.1# drush watchdog:show --severity=Error | grep 'cron\|php'
  61   18/Jan 16:33   php         Error      InvalidArgumentException: A valid cache entry key is
  58   18/Jan 16:32   php         Error      InvalidArgumentException: A valid cache entry key is
  55   18/Jan 16:32   php         Error      InvalidArgumentException: A valid cache entry key is
bash-5.1# drush watchdog:show --severity=Error | grep 'cron\|php' | grep 'A valid cache entry key is required'

I.e. the command found nothing because the line is wrapped in the display, which really seems like it should not matter.

I make my terminal fullscreen and get:

bash-5.1# drush watchdog:show --severity=Error | grep 'cron\|php' | grep 'A valid cache entry key is required'
  61   18/Jan 16:33   php         Error      InvalidArgumentException: A valid cache entry key is required. Use getAll() to get all table data. in Drupal\views\ViewsData->get() (line 140 of
  58   18/Jan 16:32   php         Error      InvalidArgumentException: A valid cache entry key is required. Use getAll() to get all table data. in Drupal\views\ViewsData->get() (line 140 of
  55   18/Jan 16:32   php         Error      InvalidArgumentException: A valid cache entry key is required. Use getAll() to get all table data. in Drupal\views\ViewsData->get() (line 140 of

I wonder what the default terminal/bash line length on where this runs internally is set to or what it is dependent on. Either way, bad news...

I changed the first bit of the script to the following to avoid the brittleness of grepping something pre-processed for display and now the script appears to be running:

ERROR_MESSAGE=$(drush watchdog:show --severity=Error --filter="InvalidArgumentException: A valid cache entry key is required" | awk '{print $6}')

@kspurgin
Copy link

Yes, and once that script did finish running successfully, the error is fixed.

@kspurgin
Copy link

I think this PR should also include adding a section to docs/troubleshooting.md to explain that you should run make fix_views if you get the error.

@DonRichards
Copy link
Member Author

@kspurgin Thanks for reviewing with suggestions and sorry for not seeing you comments earlier. This should be ready for review.

@Natkeeran Natkeeran self-assigned this Jan 26, 2022
@Natkeeran
Copy link
Contributor

After make local, ran into the issue with view when creating a basic page as described above. Ran make fix_view, and it indeed fixed the issue.

Not sure about the cause of the issue though. Wondering if we need to incorporate this a part of make local?

@DonRichards
Copy link
Member Author

I assume it won't hurt anything but it will enable all views including those that were previously disabled.

@ysuarez
Copy link
Contributor

ysuarez commented Mar 16, 2022

I ran through the steps test this PR and it worked as expected.

BTW, I looked at the proposed docs changes, and I wanted to suggest that we also mention that this issue may alternatively show up with getting a blank page that just says "The website encountered an unexpected error. Please try again later." Of course, there are other reasons why you may get an error like that, so we should warn about that too.

Also, assuming I understood how this PR works, should there be a small note that all views will be enabled in your Drupal instance after running this fix. Just in case folks end up enabling views they rather keep disabled?

I can volunteer to write these docs suggestions if they make sense others.

@DonRichards

Copy link
Contributor

@ysuarez ysuarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR works as expected.

Two observations

  • I added some feedback on a comment on this PR on March 16 on potentially adding documentation related to this code change.
  • In that same comment I wondered if there should be a documentation addition or warning when running this makefile command that all views will be set to enabled. If I am understanding the code, this may be important for users to be aware.

@DonRichards
Copy link
Member Author

Resolved merge conflicts, now ready to test again.

@DonRichards
Copy link
Member Author

@ysuarez Good point. Maybe I should add a little logic to fetch a list of which ones are enabled and only trigger those.

@ysuarez
Copy link
Contributor

ysuarez commented Apr 29, 2022

I will test this early next week.

@DonRichards
Copy link
Member Author

@ysuarez Any chance you would have time to review this? No pressure, just reviewing open PRs in preparation for the conference.

@ysuarez
Copy link
Contributor

ysuarez commented Jun 7, 2022

Don, my bad. I will try to test this by next week's tech call. Right now I am still trying to finish testing the islandora_defaults PR 66. I will put in some time while I test that other PR to test this one, since yours should be pretty simple to test.

@ysuarez
Copy link
Contributor

ysuarez commented Jun 15, 2022

@DonRichards This PR works as expected.

@ajstanley ajstanley merged commit 48a18c9 into development Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants