WordPress.org

Forums

GrabPress
API errors thrown when used with WP-CLI (1 post)

  1. I was debugging a site for a customer on our servers, and they were havign a whole pack of Varnish errors. When I was setting up a whitelist on our server, I noticed

    GrabPress:<line 958>Grabpress_API::get_feeds()
    GrabPress:<line 763>Grabpress_API::validate_key()
    GrabPress:<line 1247>Grabpress_API::call(GET, /user/validate?api_key=[REDACTED])
    status = 200, response ={"headers":{"accept-ranges":"bytes","age":"535","cache-control":"public, max-age=600","content-type":"application\/json; charset=utf-8","date":"Thu, 26 Jun 2014 15:07:38 GMT","etag":"\"[REDACTED]\"","server":"Apache\/2.2.22 (Ubuntu)","status":"200 OK","via":"1.1 varnish","x-content-type-options":"nosniff","x-frame-options":"SAMEORIGIN","x-powered-by":"Phusion Passenger 4.0.40","x-request-id":"b998f3f6-bd68-40ef-b830-5649b13e37f1","x-runtime":"0.046819","x-ua-compatible":"chrome=1","x-varnish":"1671915444 1671908686","x-xss-protection":"1; mode=block","content-length":"76","connection":"Close"},"body":"{\"user\":{\"id\":462870,\"email\":\"[REDACTED]@grab.press\"}}","response":{"code":200,"message":"OK"},"cookies":[],"filename":null}
    GrabPress:<line 716>Grabpress_API::get_connector()
    GrabPress:<line 617>Grabpress_API::validate_key()
    GrabPress:<line 1247>Grabpress_API::call(GET, /user/validate?api_key=[REDACTED]) ....

    I snipped all the rest of the API call, but it's actually dumping the API information, emails, passwords, etc. Which isn't good!

    All of that SEEMS to be coming from the function plugin_messages() which is called by this:

    add_action( 'wp_loaded', array( 'GrabPress', 'plugin_messages' ) );

    Which means EVERY time WP is loaded, that's called (see http://codex.wordpress.org/Plugin_API/Action_Reference/wp_loaded for more info).

    It's very possible that the over abundance of those calls is why Varnish is pitching a fit. I would personally change that to admin_init, if I HAD to run it on every single page load of admin, but really that seems like overkill. Instead, I would be using a Dashboard Widget (like the stats section or the Right Now one) via http://codex.wordpress.org/Dashboard_Widgets_API - that would use far less resources.

    There are whole mess of other options of course :)

    http://codex.wordpress.org/Plugin_API/Action_Reference#Administrative_Actions

    I don't know why/where this is actually needing to be called, though, without backstepping through ALL the code. You shouldn't be calling that API on every pageload though, it's really overkill. Even if you need to phone home at regular intervals to pull data, which is fine as you're a service, using a cron call would be better. Call it once an hour or five minutes if you must.

    Happy to help bang on this! Just saw it and thought perhaps there may be a better way around it :)

    https://wordpress.org/plugins/grabpress/

Reply

You must log in to post.

About this Plugin

  • GrabPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.