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

BUG: Notice: Undefined index: server_type in /var/www/html/wp-content/plugins/elasticpress/includes/classes/Elasticsearch.php on line 1322 #3063

Closed
vojkny opened this issue Oct 18, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@vojkny
Copy link

vojkny commented Oct 18, 2022

Describe the bug

This is not really bug, but annoying warning if you have all the logging on:

Notice: Undefined index: server_type in /var/www/html/wp-content/plugins/elasticpress/includes/classes/Elasticsearch.php on line 1322

Steps to Reproduce

I am not sure why this happens on my instance. Maybe there needs to be some additional erorr handling,

Expected behavior

Ideally such messages should be hidden.

Environment information

  • Device: Linux
  • OS: Debian
  • Browser and version: Chrome
  • WordPress version: 5.2.3
  • ElasticPress version: 4.3.1
  • Elasticsearch version: 8
  • Where do you host your Elasticsearch server? Own server
@vojkny vojkny added the bug Something isn't working label Oct 18, 2022
@oscarssanchez
Copy link
Contributor

Hi @knyttl ,

It would be great if you could give more details about this, there's a couple of places where that gets defined, but it should be always defined as a property as you can see here: https://github.com/10up/ElasticPress/blob/develop/includes/classes/Elasticsearch.php#L52

Ans just to make sure you are not using this filter, correct ? https://github.com/10up/ElasticPress/blob/develop/includes/classes/Elasticsearch.php#L249

Thanks!

@vojkny
Copy link
Author

vojkny commented Oct 19, 2022

Hi,

honestly I have no idea. This happens on my fresh installation and I never touch the variable.

Ans just to make sure you are not using this filter, correct ?

No I don't use it. It is just a fresh run of the plugin.

Is there a way to set this variable so that the error disappears?

@felipeelia
Copy link
Member

Hi @knyttl,

Can you please go to the Settings page, save it again, and check if the error is gone? Probably not related but your WordPress version does not match our minimum requirement (currently WP 5.6.), is it possible for you to test it against a newer version? Thanks

@vojkny
Copy link
Author

vojkny commented Oct 24, 2022

I seems that the error disappeared over the weekend. I haven't done anything at all, so nevermind 🤦

Closing 👍

@andyblackwell
Copy link

andyblackwell commented Nov 9, 2022

Seeing this as well, looks like the bug was likely introduced in #2835
and looks like in plugin version 4.2.2

when the info is pulled from transient data and the data was written from a previous version without the server_type key

https://github.com/10up/ElasticPress/blob/4.3.0/includes/classes/Elasticsearch.php#L1313-L1325
https://github.com/10up/ElasticPress/blob/3.6.3/includes/classes/Elasticsearch.php#L1330-L1348

can we reopen this @felipeelia ?

@felipeelia
Copy link
Member

@andyblackwell, the upgrade routine should delete that transient for previous versions here. Are you using object cache by any chance? We will need to determine why and in which scenarios the deletion of that transient is not happening properly.

@andyblackwell
Copy link

yes, we are using object cache via https://objectcache.pro/ installed as an mu plugin

@felipeelia
Copy link
Member

Hey @andyblackwell, did you upgrade this site before and then downgrade it? That would explain why that code was not called. Also, are you continuously getting that warning, or was it just a 1-time thing?

@andyblackwell
Copy link

andyblackwell commented Nov 10, 2022

was just a one time notice on the first load after upgrading, and no upgrade/downgrade, though after this conversation I reset the site several times to test, and it does seem to be something with object cache as you alluded to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants