dashed-slug.net › Forums › General discussion › Getting this random error sometimes: SyntaxError: JSON.parse: unexpected char…
- This topic has 2 replies, 2 voices, and was last updated 4 years, 7 months ago by alexg.
-
AuthorPosts
-
April 16, 2020 at 9:30 pm #8125d3vnu77Participant
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 dataResponse 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
WHEREoption_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”}April 16, 2020 at 9:31 pm #8126April 17, 2020 at 8:11 am #8134alexgKeymasterYes, 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
-
AuthorPosts
- You must be logged in to reply to this topic.