Git Product home page Git Product logo

Comments (4)

Craxic avatar Craxic commented on June 13, 2024

I'm also getting this problem (but without the HTTP Error.) Instead, the server just dies and the user sees "An error occurred in the upload. Please try again later.". To shed some more light on the issue, here is why it's failing for me:

  1. User logs in and gets a token as part of their cookie (call it "abcd")
  2. User goes to upload form and gets a nonce that allows them to upload. This nonce only works for the cookie with the "abcd" token.
  3. User sends upload to the wrapped URL.
  4. Upload completes, and the wrapped URL then calls the original URL. We then get into the area @jgrasser2 mentioned: (full output of print_r(debug_backtrace(), true) here:
google\appengine\WordPress\Uploads\Uploads::set_fake_cookies(USER_ID)
google\appengine\WordPress\Uploads\Uploads::authenticate()
google\appengine\WordPress\Uploads\Uploads::preauthenticate()
/base/data/home/apps/app-name/instance-name.1234/src/wp-settings.php::do_action('plugins_loaded')
/base/data/home/apps/app-name/instance-name.1234/src/wp-config.php
/base/data/home/apps/app-name/instance-name.1234/src/wp-load.php
/base/data/home/apps/app-name/instance-name.1234/src/wp-admin/async-upload.php 
  1. This overwrites the cookie token with a fresh one
  2. This causes wp_verify_nonce to fail in async_upload.php -> wp_ajax_upload_attachment -> check_ajax_referer( 'media-form' ) since the token is different.
  3. This causes the script to die.

@jgrasser2's solution works great, thanks! (although there's clearly a reason this code is in here, and I'm a bit worried that we're basically just removing it... Perhaps it was only important in the earlier versions of WordPress/GAE.)

Also, another strange thing: The project I'm working on runs two apps: one for development and one for production. The production server does not experience any issue with this specific problem (although it gets strange "time-out" issues... But that's probably unrelated.), but the development server does. I'll be back with more information if I can run some logging on the production server.

from wordpress-plugins.

DejaAugustine avatar DejaAugustine commented on June 13, 2024

When I first tried to run Wordpress 4.0 on Google Apps Engine, the isset() fix that was patched in worked fine.

However, today even with the isset() fix, I'm back to getting the "HTTP error" and "Are you sure?" messages on Wordpress 4.0, even using version 1.5 of the Google App Engine plugin.

The files are being uploaded (I can browse them on Google Storage) so I don't think it's a permissions issue on the bucket, but it looks like the metadata is missing and obviously the files aren't showing up in the Wordpress backend.

Any ideas what I might be missing?

from wordpress-plugins.

Craxic avatar Craxic commented on June 13, 2024

@DejaAugustine
I'm not sure what you're missing: all I can do is offer some general advice I guess...

  • If you're getting the HTTP Error message, try viewing the network requests in the debug console. Perhaps that might give you some more information.
  • Check the App-engine logs obviously for any errors (or requests that aren't giving 200 OK responses)
  • If all else fails, you can do what I did: Put a whole lot of syslog() calls throughout async-upload.php to figure out exactly where it fails.

Hope that helps, sorry I can't offer any advice you probably haven't already tried.

from wordpress-plugins.

DejaAugustine avatar DejaAugustine commented on June 13, 2024

@Craxic
I wonder if it was a problem on the Google API side. Without making any changes or deployments, I tried it a couple hours later and it worked.

from wordpress-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.