-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Image upload failing #9438
Comments
Also referencing #9442 for a minor problem. |
thanks @waridrox 👍 |
Attempting to debug the problem further, the error that I got when uploading an image from local file storage was After installing
After that I simply restarted the server and the file upload was functional again with file types like test.mp4From this thread on stackoverflow, we need to add these 2 lines in production.rb as well to reflect the changes in the production app. Also due to optional parameter to install image-magick in https://github.com/publiclab/plots2/blob/main/doc/PREREQUISITES.md#image-libraries-optional, this behaviour was observed in the first place. |
Thanks @waridrox, I pulled your changes and I am still getting the error....could someone else please try on their end. Thanks |
Oh 😅 really sorry about that, pls revert the pull then. Does it work locally though ? Maybe trying |
Hi all, locally it makes some sense that it's an imagemagick but (or absence of imagemagick) but on stable it should be installed. I wonder if it's a distinct bug on stable? We should cross check on Sentry.io. Cess do you have access? Thanks for finding and documenting this!! |
Sorry I mean /recent/ errors |
Aha, 302 error indeed... 🕵️ I'll look at why that may be the case. Thank you! |
I'm going to try running it in GitPod to see if i can reproduce the 302... |
OK, got a log from GitPod!
OK, so why are we being redirected to log in... looking... |
Looks like CSRF token is not working... let's see... plots2/app/views/editor/rich.html.erb Lines 344 to 347 in bd7b2e2
we pass it in here. |
|
Noting that in GitPod, the main image uploader works. It uses the same controller, so the issue seem likely to be in the Editor's rich text module code itself:
|
And actually the main image uploader also uses the token in its request: It correctly fetches it with: editor.options.mainImageModule.token
"5Z5plBlzFXbu2qCKPTDZYa54DWaNn556hs9FzyvH2U8NDMabePLVh1RlBuhkRR+Ej+kgI/hLIAm9LcdrEZv4lg==" |
Confirmed. The main image upload has this set of params in the form request:
Whereas the inline image upload has only these:
checking recent changes to that section of code, as well as the module options itself to ensure it's getting properly stored/passed in from the constructor. |
Wow, deep bug. Chasing back through jywarren/woofmark#2 to |
It's present in our branch of https://github.com/jywarren/woofmark/blob/plots2/src/prompts/prompt.js#L133 |
I believe this PR from 28 days ago may be related. the last change to the branch of |
I'm not seeing anything in the code in
|
https://www.npmjs.com/package/xhr published 2.6 5 months ago but has been at 2.2.1 for many many months in our projects. confirmed in package-lock.json |
OK, so the Does it actually generate the extra header? xhrOptions: {
beforeSend: function(xhr) { xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')) }
}, |
Gosh i don't know when this stopped working but I think we could potentially just add another Noting this would have happened either November 5 2020 in https://github.com/publiclab/PublicLab.Editor/releases/tag/v3.0 or 28 days ago in #9323 |
According to this line, i believe |
will try in GitPod: formData: {nid: null, authenticity_token: _module.options.token}, ... THAT DID IT: Will fix in publiclab/PublicLab.Editor#712, release 3.0.3, and also add the extra Whew! |
…, v3.0.3 (#712) * move csrf token into formData for bureaucracy re publiclab/plots2#9438 * bumped version and built dist
@publiclab-mimi reported today that
|
@ebarry, I think the current version still doesn't have the above changes due to buffer time required to push the changes to the live version. That's because image / file upload works on the stable version and the legacy version. |
The new code went live last night! Taking a look, i'm seeing a new error - a 500 error: starting with this one, which is the same 302 as Cess found: Then redirected to this new 500 error: which is actually upon a successful login, i believe, but it's weird because i'm already logged in? Sentry logged it here, i think, but i'm not sure if the error happens before or after the login attempt. https://sentry.io/share/issue/13e10e65210c4ceb9860ec687482d9b7/
|
Huh, having trouble tracing this so i'll try reproducing in GitPod again??? |
OK, @icarito and I were able to resolve a yarn update issue to pull in the real |
🎉 🎉 🎉 |
awesome!!! thank you |
…bliclab#9504) * move csrf token into formdata for PublicLab.Editor richTextModule ref publiclab#9438 * remove ", :fr" from application.rb re publiclab#9481
…bliclab#9504) * move csrf token into formdata for PublicLab.Editor richTextModule ref publiclab#9438 * remove ", :fr" from application.rb re publiclab#9481
Image upload fails with this error in the body section "Section 4" of
this is on the https://publiclab.org/, was able to replicate it on https://unstable.publiclab.org and locally
/post
routeNote: Image upload is working fine on "Section 2" of
/post
Template: https://github.com/publiclab/plots2/blob/main/app/views/editor/rich.html.erb
The text was updated successfully, but these errors were encountered: