Post by Nesster » Tue Oct 21, 2014 8:32 am

SyntaxError: Unexpected end of input (Chrome)
SyntaxError: Syntax Error (IE)

Hi, I have searched high and low on this issue, as this error first appeared to be related with our site being password protected (apache .htaccess file). Now as I have verified and re-verified the virtual host where OpenCart is installed, I'm sure there is no password protection. There IS a virtual host that is protected in this way on our server, but it's not relevant to OC.

I made sure the API was set up correctly too. Even tried creating another API user to make sure.
The site is not in maintenance mode.

We are working on finding the source of this problem ourselves, but I'd like to know if others still have this issue (and without htpasswd protection).

GitHub version.

Frank
Last edited by Nesster on Thu Nov 13, 2014 10:09 pm, edited 4 times in total.

Newbie

Posts

Joined
Tue Oct 21, 2014 8:09 am

Post by marmax » Tue Oct 21, 2014 5:55 pm

I use 2.0.0.0 - do you have site in maintenance mode? Try to switch it off.

Do you maybe know answer to my problem? http://forum.opencart.com/viewtopic.php?f=181&t=132717

New member

Posts

Joined
Fri Oct 10, 2014 4:34 am

Post by Nesster » Wed Oct 22, 2014 12:48 am

Here is what happened for us on this case.

First: some useful background to understand what's happening:
When, even in the admin, you modify (add, edit or delete) an order, the logic is to use the API to do so. The API acts as client, as if it was an actual client on the front-end.

While narrowing down the issue, I noticed the curl object that was created by the API was NULL (I freaking love ChromePhp btw). So it got me thinking, what if the API can't resolve my hostname (we're using apache virtualhosts for the dev environment). And that was it: Adding the servername to the /etc/hosts file pointing to the appropriate IP, it all started working.

I then setup more appropriate DNS entries and revised our NAT reflection policy to have a more adequate config, but with the hosts file it's a quick and dirty way to make sure it's not your problem also.

Frank

Newbie

Posts

Joined
Tue Oct 21, 2014 8:09 am

Post by davidnaafs » Mon Nov 10, 2014 7:36 pm

Hi, I'm experiencing this problem as well and it's driving me nuts. I do NOT have my site in maintenance mode, as is suggested throughout this forum, and as far as I can tell everything is configured as it should be. Api user is configured too.

Anyone who can help: please do! I'm offering to pay money for this, even. Thanks!

David

Newbie

Posts

Joined
Sun Nov 09, 2014 10:42 pm

Post by Nesster » Fri Nov 14, 2014 12:45 am

Make sure your oc site is not protected by a .htaccess with logon security in it. I read it also creates this problem.
As for dns (name resolution) if you have console or ssh access to your server, try to ping your hostname (the namr or domain name your site is running on). If it doesn't respond there's your problem.

Newbie

Posts

Joined
Tue Oct 21, 2014 8:09 am

Post by designbuyers » Sat Nov 15, 2014 3:33 pm

Nesster wrote:Here is what happened for us on this case.

First: some useful background to understand what's happening:
When, even in the admin, you modify (add, edit or delete) an order, the logic is to use the API to do so. The API acts as client, as if it was an actual client on the front-end.

While narrowing down the issue, I noticed the curl object that was created by the API was NULL (I freaking love ChromePhp btw). So it got me thinking, what if the API can't resolve my hostname (we're using apache virtualhosts for the dev environment). And that was it: Adding the servername to the /etc/hosts file pointing to the appropriate IP, it all started working.

I then setup more appropriate DNS entries and revised our NAT reflection policy to have a more adequate config, but with the hosts file it's a quick and dirty way to make sure it's not your problem also.

Frank

I do not think it's a proper way, it should fixed from the source not your own.

OpenCart :
The best Open Source Cart for eCommerce


User avatar
Active Member

Posts

Joined
Tue Nov 09, 2010 4:25 pm

Post by davidnaafs » Wed Nov 19, 2014 10:59 pm

I can succesfully ping my host, and as far as I can tell, (I'm not really an expert) my site isn't .htaccess password protected... Still no clue as to how I can get this fixed.. Thanks though! Any other ideas?

Newbie

Posts

Joined
Sun Nov 09, 2014 10:42 pm

Post by pm-netti » Wed Nov 19, 2014 11:41 pm

davidnaafs wrote:I can succesfully ping my host, and as far as I can tell, (I'm not really an expert) my site isn't .htaccess password protected... Still no clue as to how I can get this fixed.. Thanks though! Any other ideas?
Those need JavaScript enabled to error messages little suggestions in Github...
Last edited by pm-netti on Wed Nov 26, 2014 3:43 am, edited 1 time in total.

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by davidnaafs » Mon Nov 24, 2014 11:18 pm

Thanks for your reply, but what do you mean? Is this a suggestion for a solution to my problem? It's not clear to me what your suggestion is...

Thanks.

Newbie

Posts

Joined
Sun Nov 09, 2014 10:42 pm

Post by pm-netti » Tue Nov 25, 2014 10:52 pm

davidnaafs wrote:Thanks for your reply, but what do you mean? Is this a suggestion for a solution to my problem? It's not clear to me what your suggestion is...

Thanks.
Other option:
Open Admin > Settings > Users > API
Add API User.

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by davidnaafs » Wed Nov 26, 2014 4:38 pm

pm-netti wrote:
davidnaafs wrote:Thanks for your reply, but what do you mean? Is this a suggestion for a solution to my problem? It's not clear to me what your suggestion is...

Thanks.
Other option:
Open Admin > Settings > Users > API
Add API User.

Hi, thanks!! I have an API user set up, that doesn't work either. I wanted to try your other code suggestions, but you have edited them out of your reply?

Newbie

Posts

Joined
Sun Nov 09, 2014 10:42 pm

Post by pm-netti » Wed Nov 26, 2014 4:52 pm

davidnaafs wrote:
pm-netti wrote:
davidnaafs wrote:Thanks for your reply, but what do you mean? Is this a suggestion for a solution to my problem? It's not clear to me what your suggestion is...

Thanks.
Other option:
Open Admin > Settings > Users > API
Add API User.

Hi, thanks!! I have an API user set up, that doesn't work either. I wanted to try your other code suggestions, but you have edited them out of your reply?
Indeed, I removed the repair proposal. 8)
I immediately realized that the API user is mandatory (I thought it would be an option)
Last edited by pm-netti on Sat Nov 29, 2014 6:12 pm, edited 1 time in total.

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by davidnaafs » Wed Nov 26, 2014 9:38 pm

pm-netti wrote: Indeed, I removed the repair proposal. 8)
I immediately realized that the API user is mandatory (I thought it would be an option)
In file view/template/sale/order_form.tpl is bug:
http://forum.opencart.com/viewtopic.php ... 87#p529087
Ok thanks, so I've edited view/template/sale/order_form.tpl according to this thread and made sure (again) that I have an API user set up, I logged out and in and placed a new order. Still the same error... Other people seem to have this working, I just can't figure out what is wrong. Very frustrating...

Newbie

Posts

Joined
Sun Nov 09, 2014 10:42 pm

Post by pm-netti » Wed Nov 26, 2014 10:45 pm

davidnaafs wrote:
pm-netti wrote: Indeed, I removed the repair proposal. 8)
I immediately realized that the API user is mandatory (I thought it would be an option)
In file view/template/sale/order_form.tpl is bug:
http://forum.opencart.com/viewtopic.php ... 87#p529087
Ok thanks, so I've edited view/template/sale/order_form.tpl according to this thread and made sure (again) that I have an API user set up, I logged out and in and placed a new order. Still the same error... Other people seem to have this working, I just can't figure out what is wrong. Very frustrating...
Have you removed the API between the user and then added it again? If so, it will function causing the error.
In 'api' table column 'api_id' must be '1'. (Same as config_api_id in table 'setting'). This is designed for a slightly tricky 8)

Ps. file view/template/sale/order_form.tpl no need to change. 8)

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by shamanit » Mon Dec 01, 2014 3:03 pm

pm-netti wrote:
davidnaafs wrote:
pm-netti wrote: Indeed, I removed the repair proposal. 8)
I immediately realized that the API user is mandatory (I thought it would be an option)
In file view/template/sale/order_form.tpl is bug:
http://forum.opencart.com/viewtopic.php ... 87#p529087
Ok thanks, so I've edited view/template/sale/order_form.tpl according to this thread and made sure (again) that I have an API user set up, I logged out and in and placed a new order. Still the same error... Other people seem to have this working, I just can't figure out what is wrong. Very frustrating...
Have you removed the API between the user and then added it again? If so, it will function causing the error.
In 'api' table column 'api_id' must be '1'. (Same as config_api_id in table 'setting'). This is designed for a slightly tricky 8)

Ps. file view/template/sale/order_form.tpl no need to change. 8)
Hello.

I use apache as backend and nginx as frontend.

I get same error without "API user" in System -> Settings. Then In Iceweasel:

Code: Select all

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
OK
In Chromium:

Code: Select all

SyntaxError: Unexpected end of input

OK
When "API user" added and in System -> Settings setup "API user", then I not get response from backend server (apache), after 60 sec. frontend server (nginx) response HTTP "504 Gateway Time-out" :-\

In apache error_log no info, no PHP error logged, - without any log except nginx_log:

Code: Select all

2014/11/30 14:17:15 [error] 30172#0: *34 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 97.132.187.59, server: pinetka.org, request: "GET /admin/index.php?route=sale/order/delete&token=71ee04b5d75327906ec5cc3e48a5783a&order_id=15 HTTP/1.1", upstream: "http://127.0.0.1:81/admin/index.php?route=sale/order/delete&token=71ee04b5d75327906ec5cc3e48a5783a&order_id=15", host: "www.pinetka.org", referrer: "http://www.pinetka.org/admin/index.php?route=sale/order&token=71ee04b5d75327906ec5cc3e48a5783a"
2014/11/30 14:17:15 [error] 30172#0: *36 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 93.170.128.114, server: pinetka.org, request: "POST /index.php?route=api/login HTTP/1.1", upstream: "http://127.0.0.1:81/index.php?route=api/login", host: "www.pinetka.org"
what to do? ???

Newbie

Posts

Joined
Mon Dec 01, 2014 2:50 pm

Post by billkor » Tue Dec 02, 2014 12:59 am

i m getting the exact same error

maintenance mode is off and api user added

New member

Posts

Joined
Thu May 03, 2012 5:19 pm

Post by pm-netti » Tue Dec 02, 2014 1:50 am

@shamanit
@billkor

1. When an error is admin home page, option: make one test order ( ajax is not found orders for front)
2. Check and change need in database field 'api_id' to 1 in table 'api'

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by billkor » Tue Dec 02, 2014 2:00 am

Hi and thanks for helping

i really appreciate it

I just checked on my api table and the api id is already 1

Bellow is the exact error i m getting when i m trying to edit a order:

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

OK

New member

Posts

Joined
Thu May 03, 2012 5:19 pm

Post by shamanit » Wed Dec 03, 2014 3:31 pm

pm-netti wrote:@shamanit
@billkor

1. When an error is admin home page, option: make one test order ( ajax is not found orders for front)
2. Check and change need in database field 'api_id' to 1 in table 'api'
also
I just checked on my api table and the api id is already 1
when I change IP in apache virtualhost from 93.170.128.114 to 127.0.0.1, then msg in nginx log disappear, but edit/remove orders still dont work. In this time no log, no php error, no msg in apache log, no msg in nginx log!?! ???

if remove API user or remove API key, then get:

Code: Select all

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
OK
Otherwise frontend server (nginx) response HTTP "504 Gateway Time-out"...

hemorrhoids :-[

Newbie

Posts

Joined
Mon Dec 01, 2014 2:50 pm

Post by pm-netti » Wed Dec 03, 2014 5:21 pm

shamanit wrote:
pm-netti wrote:@shamanit
@billkor

1. When an error is admin home page, option: make one test order ( ajax is not found orders for front)
2. Check and change need in database field 'api_id' to 1 in table 'api'
also
I just checked on my api table and the api id is already 1
when I change IP in apache virtualhost from 93.170.128.114 to 127.0.0.1, then msg in nginx log disappear, but edit/remove orders still dont work. In this time no log, no php error, no msg in apache log, no msg in nginx log!?! ???

if remove API user or remove API key, then get:

Code: Select all

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
OK
Otherwise frontend server (nginx) response HTTP "504 Gateway Time-out"...

hemorrhoids :-[
Clean setting table:
http://forum.opencart.com/viewtopic.php ... 97#p530417
And add settings config_processing_status and config_complete_status

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland
Who is online

Users browsing this forum: No registered users and 15 guests