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

Pass empty array if no schema is found #4211

Merged
merged 5 commits into from
Jul 8, 2024
Merged

Pass empty array if no schema is found #4211

merged 5 commits into from
Jul 8, 2024

Conversation

janette
Copy link
Member

@janette janette commented Jul 2, 2024

ref: 20621

TypeError: Drupal\common\Storage\AbstractDatabaseTable::getSchema(): Return value must be of type array, null returned in Drupal\common\Storage\AbstractDatabaseTable->getSchema() (line 397 of /var/www/html/dkan/modules/common/src/Storage/AbstractDatabaseTable.php). 

When data publishers rely on cron to run the queues, a datastore query may return the above 500 error on getSchema() when:

  1. a data file (downloadURL) has been updated
  2. the localize_import has run
  3. the datastore_import has not run
  4. a datastore/query API call is made to the missing datastore

To avoid the 500 error:
Allow getSchema to return an empty array, the query will then be caught by queryResource and return a 400

Copy link
Member

@dafeder dafeder left a comment

Choose a reason for hiding this comment

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

This should have a test, either a unit test for the class or in a functional test of the API. Pretty sure this once worked and then broke, a test should have caught that in the first place.

modules/common/src/Storage/AbstractDatabaseTable.php Outdated Show resolved Hide resolved
modules/common/src/Storage/AbstractDatabaseTable.php Outdated Show resolved Hide resolved
@dafeder dafeder merged commit ff7a404 into 2.x Jul 8, 2024
10 checks passed
@dafeder dafeder deleted the fix-null-schema branch July 8, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants