ocr_b Posted July 10, 2017 Share Posted July 10, 2017 So i simply wanted to add an image to an image field, like i always do, like it's always working. Suddenly a wild console error appears and the loader icon won't stop spinning. PW 3.0.62 as well als PW 3.0.65, Client side resizing as well als Server side From Firefox i get this: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data[Weitere Informationen] JqueryCore.js:2:13582 parseJSON http://...com/dev/wire/modules/Jquery/JqueryCore/JqueryCore.js:2:13582 uploadFile/< http://...com/dev/wire/modules/Inputfield/InputfieldImage/InputfieldImage.js:1433:21 From Chrome i get this: VM132:1 Uncaught SyntaxError: Unexpected token W in JSON at position 0 at JSON.parse (<anonymous>) at Function.parseJSON (JqueryCore.js:2) at XMLHttpRequest.<anonymous> (InputfieldImage.js?v=119-1499692884:1433) parseJSON @ JqueryCore.js:2 (anonymous) @ InputfieldImage.js?v=119-1499692884:1433 Any Ideas ? Link to comment Share on other sites More sharing options...
bernhard Posted July 10, 2017 Share Posted July 10, 2017 hi ocr_b, what do you mean by "suddenly"? did you install some updates? any server changes? any other installed modules (or updates of those)? try it with a fresh install, different image, different server etc... 1 Link to comment Share on other sites More sharing options...
ocr_b Posted July 11, 2017 Author Share Posted July 11, 2017 suddenly means that i uploaded some images, waited one week for the new images from the client and changed nothing in the meantime. meanwhile i found the error. the only thing i changed was: $config->debug = true;so i changed it back to $config->debug = false; and the upload works fine again. any idea why this wont work with debug mode? with the same provider i tried a different website from a different client: going into debug mode disables the image upload. so where can i post bugs and which information do i need to provide? Link to comment Share on other sites More sharing options...
bernhard Posted July 11, 2017 Share Posted July 11, 2017 you can report issues here: https://github.com/processwire/processwire-issues but i think it's too early to report this as an issue since the image field is commonly used without any problems. i guess it is somehow related to your setup. what is the output of your response (you see it in the network tab of your dev-tools)? it seems that you have an error that throws only when debug is ON. when you switch it off the error is supressed and therefore the upload works. check also your error logs of processwire and your server. i'm quite sure you'll find valuable information there 1 Link to comment Share on other sites More sharing options...
ocr_b Posted July 11, 2017 Author Share Posted July 11, 2017 The only thing that logs is the image sizer:GD Resized: aj5a5418-lv-cover-haare-b-1.jpg => aj5a5418-lv-cover-haare-b-1.0x260.jpg (0x260) 1.0484 secs 690761 => 11702 bytes (quality=90, sharpening=soft) This does not log with debug set to false. I don't know what to read out of that. Network is the same: ?id=1&InputfieldFileAjax=1 POST 200 xhr InputfieldImage.min.js?v=120-1499176758 1 1.5 KB 2.77 s Well, the thumbnail is 260px height, that's the log, and the console states me that W is an unexpected token in JSON, see first post. So W stands for width and means that there is a parse error in the javascript when no width is given or is set to zero? ps. the only two modules on both processwire installations that are running are »all in one minify« and »reno theme«. both should not affect the image upload. ps2. i already tried to reproduce it with a local server or a different provider, but the error does not occur. i am still curious what makes this provider special that this wont work? is it even a provider issue? all processwire installations i tried are basically the same... Link to comment Share on other sites More sharing options...
Robin S Posted July 11, 2017 Share Posted July 11, 2017 @ocr_b, you get the JSON parse error because the response from the server is some error message rather than the JSON object that is expected. If you search the forum (using Google) you'll find a number of topics that could be useful in tracking down the problem. Here are a couple: Based on comments in the forum some things to look at are: post_max_size, upload_max_filesize, max_execution_time, max_input_time, memory_limit mod_security (disable it) upload_tmp_dir 4 Link to comment Share on other sites More sharing options...
j__ Posted April 14, 2018 Share Posted April 14, 2018 Did anybody find a solution to this error yet? I recently encountered the same JSON error in a different situation and posts on these errors (https://processwire.com/talk/topic/8712-imagefile-upload-problems-without-errors/, https://processwire.com/talk/topic/16716-jquery-error-in-inputfieldimage/ and https://processwire.com/talk/topic/17132-image-doesnt-save/) read like it's most likely the server setup causing those errors. However, I get the JSON error on just one out of two multi-sites: Both sites use the same server, same server config files and same /wire/ directory, but different /site-*/folders and different databases Image upload and file upload are generally working Upload limits (post_max_size, upload_max_filesize, max_execution_time etc.) are set to values high enough Uploads on site 1 are working absolutely fine and without any errors Uploads on site 2 are working with all files (images, pdf etc.) up to 1 MB (1.023 KB). File sizes > 1 MB (i.e. 1.054 KB or bigger) never finish uploading (with the loader icon spinning endlessly) and lead to the console error: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data JqueryCore.js:2:13582 parseJSON https://www.domain.com/wire/modules/Jquery/JqueryCore/JqueryCore.js:2:13582 o/< https://www.domain.com/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js:1:4714" I don't quite know where to debug since the server settings are definitely not causing this (since site 1 uploads are working fine). Any idea, why 1 MB/1.024 KB is a invisible limit with these uploads? Link to comment Share on other sites More sharing options...
dragan Posted April 14, 2018 Share Posted April 14, 2018 Do you have debug-mode on or off? And do you use Tracy Debugger? Chances are, if using Tracy, you will see some addtl. infos about this error. Link to comment Share on other sites More sharing options...
j__ Posted April 14, 2018 Share Posted April 14, 2018 10 minutes ago, dragan said: Do you have debug-mode on or off? And do you use Tracy Debugger? Chances are, if using Tracy, you will see some addtl. infos about this error. Debug mode is off. I use Tracy Debugger on a local PW installation, but haven't seen any information from Tracy on the uploader, the AJAX section is quite empty. Where do I have to look? Link to comment Share on other sites More sharing options...
Robin S Posted April 14, 2018 Share Posted April 14, 2018 2 hours ago, j__ said: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data JqueryCore.js:2:13582 This means that the response is not the JSON that is expected - there is probably an error message or something else revealing at the start of the response. See the post below for how you can use your browser dev tools to inspect the response and find out what the error is: Link to comment Share on other sites More sharing options...
adrian Posted April 15, 2018 Share Posted April 15, 2018 4 hours ago, j__ said: I use Tracy Debugger on a local PW installation, but haven't seen any information from Tracy on the uploader, the AJAX section is quite empty. Where do I have to look? Try Tracy in Strict Mode (you can toggle from the Panel Selector). If nothing shows up there, be sure to look at the Network Response tab in the browser dev console and make sure you check Disable Cache: https://processwire.com/talk/topic/17089-images-disapear-after-uploading-and-saving/?do=findComment&comment=150139 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now