error while saving content: SyntaxError: Unexpected token G in JSON at position 5

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cruisey
    Member
    • Apr 2018
    • 53
    • 4.2.x

    [Resolved] error while saving content: SyntaxError: Unexpected token G in JSON at position 5

    Members have threaten to leave our forum. Upload does not work correctly despite changing the php values for max_upload and post value to, at least, 100M. Can you tell us what causes this issue please?

    I've attached at image of the consoleClick image for larger version  Name:	Screen Shot 2018-09-12 at 13.32.07.png Views:	1 Size:	152.1 KB ID:	4398226
    I upgraded to 5.0.3 and when I try to post this error pops up. "Error while saving content: SyntaxError: JSON.parse: unexpected non-whitespace character
    Last edited by Cruisey; Thu 27 Sep '18, 7:17am.
  • glennrocksvb
    Former vBulletin Developer
    • Mar 2011
    • 4021
    • 5.7.X

    #2
    HTTP 504 is a gateway timeout error on your server.


    Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

    Comment

    • Cruisey
      Member
      • Apr 2018
      • 53
      • 4.2.x

      #3
      Thanks. I have increased those three values then restart apache2. Same issue. New console log:

      Click image for larger version

Name:	Screen Shot 2018-09-13 at 09.21.12.png
Views:	359
Size:	30.2 KB
ID:	4398312\

      What are ALL the possibilities that affect this issue?

      Comment

      • Wayne Luke
        vBulletin Technical Support Lead
        • Aug 2000
        • 74126

        #4
        If you click on the error in the Network tab, it will show the headers and response in tabs. What is the complete response? What were you doing when the error occurred? Step by step including permissions of the user and any post content.

        Though it appears to be polling for new vB Messenger data for the user when it is failing. You can temporarily turn off vBulletin Messenger to remove that polling. Settings -> Options -> Private Messaging and vBulletin Messenger Options. Set Enable vB Messenger to no.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API

        Comment

        • Cruisey
          Member
          • Apr 2018
          • 53
          • 4.2.x

          #5
          Network tab has no error, only in console

          Click image for larger version  Name:	Screen Shot 2018-09-13 at 20.07.48.png Views:	1 Size:	116.9 KB ID:	4398366

          More information... I got the text/ error and the response:

          Code:
          <html>
          <head><title>504 Gateway Time-out</title></head>
          <body bgcolor="white">
          <center><h1>504 Gateway Time-out</h1></center>
          <hr><center>nginx/1.12.2</center>
          </body>
          </html>
          <!-- a padding to disable MSIE and Chrome friendly error page -->
          <!-- a padding to disable MSIE and Chrome friendly error page -->
          <!-- a padding to disable MSIE and Chrome friendly error page -->
          <!-- a padding to disable MSIE and Chrome friendly error page -->
          <!-- a padding to disable MSIE and Chrome friendly error page -->
          <!-- a padding to disable MSIE and Chrome friendly error page -->
          Attached Files
          Last edited by Cruisey; Thu 13 Sep '18, 11:16am.

          Comment

          • Mark.B
            vBulletin Support
            • Feb 2004
            • 24287
            • 6.0.X

            #6
            I'm just a bit concerned by this post:
            Since upgraded from vb4 to vb5, most users has an old url with a .html at the end. I need to remove that before it called the routing.php. How to achieve this? I tried to add this in the .htaccess file: # Main Redirect RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css)$ RewriteCond %{REQUEST_FILENAME} !-f


            If I've read this right, you've editing the routing.php file. This isn't really a very good idea and I suspect it may be no coincidence that you're now experiencing issues.

            In the first instance I would restore the file to its default state, clear the system cache, and see if the issue persists.
            MARK.B
            vBulletin Support
            ------------
            My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
            My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

            Comment

            • Cruisey
              Member
              • Apr 2018
              • 53
              • 4.2.x

              #7
              Originally posted by Mark.B
              I'm just a bit concerned by this post:
              https://www.vbulletin.com/forum/foru...24#post4398224

              If I've read this right, you've editing the routing.php file. This isn't really a very good idea and I suspect it may be no coincidence that you're now experiencing issues.

              In the first instance I would restore the file to its default state, clear the system cache, and see if the issue persists.
              While that's correct, I have no issue on local dev laptop. This is what I added, else there is a better way:

              Code:
              // routing.php on line 120 of vb 5.4.3 inside the try block
              
                          if ($route === false) {
                              global $vbulletin;
              
                              $path_array = explode('/', $path);
                              // Get last element in array
                              $query_string = end($path_array);
                              // Separate old nodeid from string
                              $id_string = explode('-', $query_string);
                              // Use oldid
                              $oldid = $id_string[0];
              
                              if (intval($oldid)) {
                                  $query = $vbulletin->db->query_read(
                                      "SELECT
                                          nodeid,
                                          oldid
                                      FROM
                                          node
                                      WHERE
                                          oldid = $oldid
                                      AND
                                          urlident
                                      IS NOT NULL
                                  ");
                                  $result = $vbulletin->db->fetch_array($query);
                                  $url = vB_Api::instanceInternal('route')->getAbsoluteNodeUrl($result['nodeid']);
                                  header('Location: ' . $url, true, 301);
                                  exit;
                              }
              
                              // Continue as normal if $oldid is not an integer <-- DO NOT REMOVE THIS COMMENT
                          }
              Last edited by Cruisey; Thu 13 Sep '18, 12:57pm.

              Comment

              • Wayne Luke
                vBulletin Technical Support Lead
                • Aug 2000
                • 74126

                #8
                If you look at the response tab when the error is triggered, it will have the raw JSON which is what is triggering the error. You're showing the preview tab which isn't helpful as a screenshot. Need to see the entire JSON that is returned.
                Translations provided by Google.

                Wayne Luke
                The Rabid Badger - a vBulletin Cloud demonstration site.
                vBulletin 5 API

                Comment

                • Cruisey
                  Member
                  • Apr 2018
                  • 53
                  • 4.2.x

                  #9
                  Ok ill see what is causing this on the server as the response is of a server issue:

                  Code:
                  <html>
                  <head><title>504 Gateway Time-out</title></head>
                  <body bgcolor="white">
                  <center><h1>504 Gateway Time-out</h1></center>
                  <hr><center>nginx/1.12.2</center>
                  </body>
                  </html>
                  <!-- a padding to disable MSIE and Chrome friendly error page -->
                  <!-- a padding to disable MSIE and Chrome friendly error page -->
                  <!-- a padding to disable MSIE and Chrome friendly error page -->
                  <!-- a padding to disable MSIE and Chrome friendly error page -->
                  <!-- a padding to disable MSIE and Chrome friendly error page -->
                  <!-- a padding to disable MSIE and Chrome friendly error page -->

                  Comment

                  • Cruisey
                    Member
                    • Apr 2018
                    • 53
                    • 4.2.x

                    #10
                    Also, when you refresh the browser, the content is shown so I guess an ajax response gone wrong or never returned in time to the browser?

                    Comment

                    • Wayne Luke
                      vBulletin Technical Support Lead
                      • Aug 2000
                      • 74126

                      #11
                      As stated above, the error doesn't seem to have anything to do with actually creating content. Based on your images, it appears to be due to polling to see if the user has new private messages. Without the full JSON, I can't see where that error is occurring.
                      Translations provided by Google.

                      Wayne Luke
                      The Rabid Badger - a vBulletin Cloud demonstration site.
                      vBulletin 5 API

                      Comment

                      • Cruisey
                        Member
                        • Apr 2018
                        • 53
                        • 4.2.x

                        #12
                        Ive disable vB Messenger but same issue.

                        Comment

                        • Cruisey
                          Member
                          • Apr 2018
                          • 53
                          • 4.2.x

                          #13
                          Wayne Luke If you could point me in the right direction, what file/controller executes the sql query to insert the data into the database? I could do a hack until we sort the server issue out. Instead of waiting for a response, we'll refresh the page regardless. Is that in a js minified file somewhere; the footer-rollup-543,js?

                          Comment

                          • Wayne Luke
                            vBulletin Technical Support Lead
                            • Aug 2000
                            • 74126

                            #14
                            To be honest, I don't know what file the error is being caused by because you haven't provided the information that I asked for.
                            Translations provided by Google.

                            Wayne Luke
                            The Rabid Badger - a vBulletin Cloud demonstration site.
                            vBulletin 5 API

                            Comment

                            • Cruisey
                              Member
                              • Apr 2018
                              • 53
                              • 4.2.x

                              #15
                              Originally posted by Wayne Luke
                              To be honest, I don't know what file the error is being caused by because you haven't provided the information that I asked for.
                              I did provide it. I figured how that section works, in createcontent.php inside a function called "createNewNode". Basically, the server times out without sending back a json; it returns the html

                              Click image for larger version  Name:	Screen Shot 2018-09-17 at 19.30.47.png Views:	1 Size:	68.4 KB ID:	4398628
                              The "$output" is html, not an array. This was actually the server timing out. We are using reverse proxy so somewhere when the data is saved in the database, data takes long to return for the js to update. There's no nodeid nor retUrl. I can confirm that this is a server related issue and not vBulletin. Many thanks for your continued support.

                              Comment

                              Related Topics

                              Collapse

                              Working...