Skip to content

SQL and JS errors with Yoast SEO #1452

@enricobattocchi

Description

@enricobattocchi

Running Yoast SEO on Playground is currently impossible due to some errors:

Javascript errors

When editing a post with Yoast SEO active, the metabox is not rendered correctly (only the tab headers are present). This likely caused by the errors you can see in the browser console:

Uncaught SyntaxError: Identifier '__playground_readBlobAsText' has already been declared 
    (at block-editor.js?ver=e5a33cfc15f28fed4770:1:1)

Uncaught TypeError: window.yoast.initEditorIntegration is not a function
    at HTMLDocument.<anonymous> (post-edit.js?ver=19783a5bd770749a31a0:24:6786)

The first one seems to be caused by a double injection of the __playground_readBlobAsText code not just into the WP Core, but also in the plugin's block-editor.js file since unfortunately it shares the last part of the path that's used to identify where to inject that code.
Could the path matching be made more unique to make sure only WP core and Gutenberg are targeted?

From what I can see, the second error is triggered by the first one preventing the correct initialization of the window.yoast object, so fixing the above would restore the metabox functionality.

SQL errors

On plugin activation some DB queries fail due to unsupported syntax. It seems that some of them should be supported by SQLite according to the documentation, while others are legitimate MySQL queries that may require to be translated.
They are:

  • ALTER TABLE <table> ADD <column>, while ALTER TABLE <table> ADD COLUMN <column> seems to be working (docs)
  • ALTER TABLE <table> CHANGE <column> which doesn't seem to be supported in SQLite (docs)
  • ALTER TABLE <table> CONVERT TO CHARACTER SET which doesn't seem to be supported in SQLite (docs)
  • CREATE INDEX <index> and CREATE UNIQUE INDEX <index> (docs)
  • SHOW KEYS FROM <table> which doesn't seem to be supported in SQLite

Actually these queries are related to our custom Indexables tables, which are usually disregarded in non-production environments. We may make sure that they are unused in Playground too, but some of the queries may run and return errors: in this scenario, though, they would not be relevant. Would there be a way to silence those errors or let those queries fail gracefully?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions