• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

3.2 JSON Parse error: Unrecognized token '<' Password bug

Scheduled Pinned Locked Moved
Beta Firmware
8
58
3.6k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    alankilian
    last edited by alankilian 1 Aug 2021, 21:42 8 Jan 2021, 21:41

    (I'm NOT a JavaScript guy, so....))

    It looks like the code is trying to parse a JSON tesponse, but the response is not JSON, it's text.

    I notice in PollConnector.js this code:

    				if (xhr.status >= 200 && xhr.status < 300) {
    					if (responseType === 'json') {
    						try {
    							if (!xhr.responseText) {
    								resolve(null);
    							} else {
    								resolve(JSON.parse(xhr.responseText));
    							}
    						} catch (e) {
    							reject(e);
    						}
    					} else {
    						resolve(xhr.response);
    					}
    

    But in BaseConnector.js I see this code:

    				if (xhr.status >= 200 && xhr.status < 300) {
    					try {
    						if (!xhr.responseText) {
    							resolve(null);
    						} else {
    							resolve(JSON.parse(xhr.responseText));
    						}
    					} catch (e) {
    						reject(e);
    					}
    

    Maybe if you use the code from PollConnector.js in BaseConnector.js you'll fix the issue.

    SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

    1 Reply Last reply Reply Quote 0
    • undefined
      Charlie @Phaedrux
      last edited by 8 Jan 2021, 22:21

      @Phaedrux

      It appears as though this is NOT occurring in Chrome, though Ive been having issues replicating the error recently.

      1 Reply Last reply Reply Quote 0
      • undefined
        Phaedrux Moderator
        last edited by 8 Jan 2021, 22:23

        Wouldn't be the first time Safari has behaved oddly.

        Z-Bot CoreXY Build | Thingiverse Profile

        undefined 1 Reply Last reply 8 Jan 2021, 22:26 Reply Quote 0
        • undefined
          Charlie @Phaedrux
          last edited by Charlie 1 Sept 2021, 01:58 8 Jan 2021, 22:26

          @Phaedrux

          Hahaha! Very true.

          I am testing out the solution by @Sindarius and I will report back the results.

          1 Reply Last reply Reply Quote 0
          • undefined
            Charlie
            last edited by 9 Jan 2021, 02:03

            @Sindarius

            Your solution appears to have worked! I deleted M551 and no more error messages in Safari.

            1 Reply Last reply Reply Quote 1
            • undefined
              Charlie
              last edited by 9 Jan 2021, 02:09

              @alankilian

              Thank you so much for your response, but I have no clue how I would go about changing this, as I have no clue where these files (don't even know if the files sit on the Duet, lol).

              undefined 1 Reply Last reply 9 Jan 2021, 04:53 Reply Quote 0
              • undefined
                alankilian @Charlie
                last edited by 9 Jan 2021, 04:53

                @Charlie "Ive diffchecked both the "pollconnector.js" and the "BaseConnector.js" files against the files in GitHub and they appear to be identical. Im pretty out of my depth when it comes to coding, so any help would be greatly appreciated."

                Oh, I figured if you checked those files you'd be ready-to-go. My machine is at the lab and I haven't been going in there due to COVID-19, so I can't check.

                I don't know where the files are either, but the .zip file has them in: store\machine\connector

                Is that a place on your Duet?

                SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

                undefined 1 Reply Last reply 9 Jan 2021, 17:18 Reply Quote 0
                • undefined
                  chrishamm administrators
                  last edited by 9 Jan 2021, 10:30

                  @Charlie Thanks for the log, I'll try to reproduce this in Safari but I am surprised it tries to parse invalid JSON at some point - even because it should never attempt to parse anything once it gets back HTTP code 401.

                  @alankilian BaseConnector is the base class of PollConnector and that particular function is only used when connecting. The JS files are bundled by Webpack into very few files to accelerate the initial page load.

                  Duet software engineer

                  1 Reply Last reply Reply Quote 0
                  • undefined
                    Charlie @alankilian
                    last edited by 9 Jan 2021, 17:18

                    @alankilian

                    This is what I have on the SD card, and a search of the file names turned up nothing. I could be looking in the wrong place though, since I have no clue where those files sit, or how to modify them.

                    Screen Shot 2021-01-09 at 12.13.10 PM.png

                    1 Reply Last reply Reply Quote 0
                    • undefined
                      alankilian
                      last edited by 9 Jan 2021, 17:21

                      @chrishamm said in 3.2 JSON Parse error: Unrecognized token '<':

                      The JS files are bundled by Webpack into very few files to accelerate the initial page load.

                      I don't know what this message from @chrishamm means.

                      I'm guessing that when the firmware is built a bunch of these files get packed together somehow, renamed and put somewhere on the Duet.

                      Sorry I'm not better versed in the Internets-part of 3D printing.

                      SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

                      undefined 1 Reply Last reply 9 Jan 2021, 17:36 Reply Quote 0
                      • undefined
                        Charlie @alankilian
                        last edited by 9 Jan 2021, 17:36

                        @alankilian

                        Neither do I.

                        No worries! You've been super helpful, and way more knowledgeable than myself! I greatly appreciate your time.

                        Since changing the browser or removing the password GCode fixed this issue, Im super happy.

                        1 Reply Last reply Reply Quote 1
                        • undefined
                          xenon2008
                          last edited by 18 Jan 2021, 09:20

                          Hello Guys,
                          have the same Problem.
                          Updated to the latest RFF Version since 2-3 Days and now i always get this error!

                          I already uploaded the whole ZIP file again, deleted all gcodes files on the Duet Webinterface but nothing works.
                          Created also a new Thread here:

                          https://forum.duet3d.com/topic/21024/json-error-and-connection-drops/4

                          I am using Google Chrome and get this error, so i think it is not a Browser Problem..

                          Kind Regards

                          Sindariusundefined 1 Reply Last reply 18 Jan 2021, 11:27 Reply Quote 0
                          • Sindariusundefined
                            Sindarius @xenon2008
                            last edited by 18 Jan 2021, 11:27

                            @xenon2008 do you happen to have a m551 in your config setting a password. The last person who was having problems removed it and it worked. Wonder if there is an issue with passwords.

                            1 Reply Last reply Reply Quote 1
                            • undefined
                              xenon2008
                              last edited by 18 Jan 2021, 12:43

                              hmmm thats an idea, i really had an password in my DWC!
                              i will try this as soon as i'm at home at the printer!
                              Thanks alot!

                              1 Reply Last reply Reply Quote 0
                              • undefined
                                xenon2008
                                last edited by 19 Jan 2021, 20:26

                                Good Evening,

                                sorry for the late Reply, but i must work every Day so long..
                                i now have commented out the Passwort in den config.g and rebooted my Duet 2 Wifi.
                                Currently i run a testprint, and have a look, but until yet it looks good. I hope it stays that way!

                                But if so, what i or we can do, so that i can use a Password Protection without any Errors?

                                1 Reply Last reply Reply Quote 0
                                • undefined
                                  Phaedrux Moderator
                                  last edited by 19 Jan 2021, 20:27

                                  Did your password contain any special characters? Can you test a simple password?

                                  Z-Bot CoreXY Build | Thingiverse Profile

                                  undefined 1 Reply Last reply 20 Jan 2021, 06:02 Reply Quote 0
                                  • undefined
                                    xenon2008 @Phaedrux
                                    last edited by 20 Jan 2021, 06:02

                                    @Phaedrux
                                    No it is only a lowercase Word, nothing special

                                    1 Reply Last reply Reply Quote 0
                                    • undefined
                                      xenon2008
                                      last edited by 21 Jan 2021, 05:32

                                      Good Morning!

                                      Since i have uncommented the Password Line in the config.g it seems to work?

                                      How can i report this as a Bug?

                                      1 Reply Last reply Reply Quote 0
                                      • undefined
                                        Phaedrux Moderator
                                        last edited by 21 Jan 2021, 05:34

                                        @xenon2008 Consider it reported. Thanks.

                                        @chrishamm will be glad you were able to replicate it.

                                        Z-Bot CoreXY Build | Thingiverse Profile

                                        1 Reply Last reply Reply Quote 0
                                        • undefined
                                          chrishamm administrators
                                          last edited by 21 Jan 2021, 11:22

                                          I'm sorry but I'm having trouble reproducing this issue. It's all working as expected on Windows (Firefox), Linux (Chromium), and OS X (Safari). Can you confirm that you are using RRF 3.2 and DuetWiFiServer 1.25?

                                          Duet software engineer

                                          undefined 1 Reply Last reply 22 Jan 2021, 18:32 Reply Quote 0
                                          • First post
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA