I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Getting this random error sometimes: SyntaxError: JSON.parse: unexpected char…

dashed-slug.net Forums General discussion Getting this random error sometimes: SyntaxError: JSON.parse: unexpected char…

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8125
    d3vnu77
    Participant

    When ajax calls…

    https://n2aa.net/?__wallets_apiversion=3&__wallets_action=get_coins_info

    Most of the time it call it, it is ok… but sometimes… I get the error below, my template warns me about it with the following error attached in the screenshot.

    Persist Logs
    Disable Cache
    173 requests
    829.67 KB / 96.46 KB transferred
    Finish: 1.35 min
    DOMContentLoaded: 1.16 s
    load: 4.05 s
    SyntaxError: JSON.parse: unexpected character at line 4 column 1 of the JSON data

    Response Payload

    1

    2

    3

    4

    <div id=”error”><p class=”wpdberror”>WordPress database error: [Deadlock found when trying to get lock; try restarting transaction]<br />DELETE FROM <code>wp_options WHERE option_name = 'vendor_verification_added'</p></div>{“coins”:{“ARMS”:{“symbol”:”ARMS”,”name”:”2ACoin”,”is_fiat”:false,”is_crypto”:true,”icon_url”:”https:\/\/n2aa.org\/wp-content\/uploads\/2019\/07\/arms-64px-coin-icon.png”,”sprintf”:”ARMS %01.8f”,”extra_desc”:”Payment ID (optional)”,”explorer_uri_address”:false,”explorer_uri_tx”:”https:\/\/explorer.2acoin.org\/?hash=%s#blockchain_transaction”,”balance”:5789.7082377963,”available_balance”:5789.7082377963,”rate”:0.01072005,”move_fee”:0,”move_fee_proportional”:0,”withdraw_fee”:0.001,”withdraw_fee_proportional”:0,”min_withdraw”:0.01,”deposit_address”:”gunsD3m5C3JKzkWeDpUjadBRS3JQjWsyi7mC9ZnusQ9B3zT53fAQjYnZ2zSuUfziSq6kaZbYDv8SwRmDDuNi7URK35hEWcCKSH”}},”result”:”success”}

    #8126
    d3vnu77
    Participant

    The error screenshot

    Attachments:
    You must be logged in to view attached files.
    #8134
    alexg
    Keymaster

    Yes, you would get this error message if the JSON API did not return a JSON response but an HTML. If you follow the URL you gave me you’ll see that it responds with your web page, not JSON.

    I cannot know why this happens on first inspection, but here’s some guesses:

    1. Check your server cache or caches. First, disable your caching mechanism altogether to see if it makes a difference. Then enable it again. Look at any caching mechanisms you use on your server and try to add to your exclusion list or whitelist URLs that include the GET parameter __wallets_action. For some popular caching mechanism the plugin will warn you about this.

    2. Check your server configuration. It is possible that your apache mod_rewrite rules or your nginx config does not allow for URLs of this type. If unsure, revert to the recommended configs for WordPress and try again. Currently the JSON API endpoint you gave me shows your webpage, while it should be responding with JSON, even if you are not logged in. The plugin will not work until this is fixed.

    3. The DB deadlock you report indicates that maybe your MySQL server needs to be restarted. I have seen this type of deadlock before but only occurs while starting my machine, and it’s not something serious. It simply means that the new exchange rates for coins were not saved in this particular instance, but will be saved again in a few minutes.

    Hope this helps. Please check the above and let me know if you need further help or if you weren’t able to resolve the issue.

    with regards

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.