Page 1 of 5
[SOLVED] Admin, Add or Edit Order - Unexpected end of input
Posted: Tue Oct 21, 2014 8:32 am
by Nesster
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
Re: Admin, Add or Edit Order - Unexpected end of input
Posted: Tue Oct 21, 2014 5:55 pm
by marmax
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
[SOLVED] Re: Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Oct 22, 2014 12:48 am
by Nesster
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
Re: Admin, Add or Edit Order - Unexpected end of input
Posted: Mon Nov 10, 2014 7:36 pm
by davidnaafs
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
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Fri Nov 14, 2014 12:45 am
by Nesster
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.
Re: [SOLVED] Re: Admin, Add or Edit Order - Unexpected end o
Posted: Sat Nov 15, 2014 3:33 pm
by designbuyers
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.
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Nov 19, 2014 10:59 pm
by davidnaafs
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?
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Nov 19, 2014 11:41 pm
by pm-netti
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...
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Mon Nov 24, 2014 11:18 pm
by davidnaafs
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.
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Tue Nov 25, 2014 10:52 pm
by pm-netti
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.
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Nov 26, 2014 4:38 pm
by davidnaafs
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?
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Nov 26, 2014 4:52 pm
by pm-netti
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.
I immediately realized that the API user is mandatory (I thought it would be an option)
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Nov 26, 2014 9:38 pm
by davidnaafs
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...
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Nov 26, 2014 10:45 pm
by pm-netti
davidnaafs wrote:
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
Ps. file view/template/sale/order_form.tpl no need to change.

Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Mon Dec 01, 2014 3:03 pm
by shamanit
pm-netti wrote:davidnaafs wrote:
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
Ps. file view/template/sale/order_form.tpl no need to change.

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?

Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Tue Dec 02, 2014 12:59 am
by billkor
i m getting the exact same error
maintenance mode is off and api user added
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Tue Dec 02, 2014 1:50 am
by pm-netti
@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'
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Tue Dec 02, 2014 2:00 am
by billkor
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
Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Dec 03, 2014 3:31 pm
by shamanit
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

Re: [SOLVED] Admin, Add or Edit Order - Unexpected end of in
Posted: Wed Dec 03, 2014 5:21 pm
by pm-netti
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