Page 1 of 5

Service error: Object [object Array] has no method 'replace'

Posted: Thu Nov 28, 2013 3:23 pm
by Adam Garbinski

Hello,
I have problem with one of my REST services. I haven't tested it for quite a while so it is hard to say for me when exactly it stopped working. What I am sure is that it worked fine a while ago. What I get now at the console is the following error:

Uncaught TypeError: Object [object Array] has no method 'replace' appery.js:1703
Appery.RestService.$t.createClass.__performHeaderParametersSubstitutions appery.js:1703
Appery.RestService.$t.createClass.process appery.js:1571
Appery.DataSource.$t.createClass.execute appery.js:1483
$.die.live.click VM103045:396
jQuery.event.dispatch jquery-1.8.2.js:3063
elemData.handle.eventHandle

The service is never executed (I have an event set at service error trapping JS so I see nothing happens, it is just this error at the console).

When I test the REST service by manually entering request parameters it gives "Test was successful" response. So the service itself is ok, perhaps it is something wrong with the mapping.

These are my service settings:

Image

These are my request parameters:
Image

This is my mapping on the page:
Image

My app is already shared with Appery suport, and it is called '3mamcukier'.

Please help me find out what is wrong.


Service error: Object [object Array] has no method 'replace'

Posted: Thu Nov 28, 2013 3:54 pm
by Maryna Brodina

Hello! As we can see from error in Header request parameter you send array, but it should be string.


Service error: Object [object Array] has no method 'replace'

Posted: Thu Nov 28, 2013 6:07 pm
by Bożena Garbińska

Hi Maryna,

There are two header request parameters:

X-Appery-Database-id (passed from service settings)
X-Appery-Session-Token (in my case passed from local variable called _SessionToken)

Please look at this:
Image

It does not look like these are arrays. So where exactly should I look for arrays being passed to service parameters?


Service error: Object [object Array] has no method 'replace'

Posted: Thu Nov 28, 2013 6:48 pm
by Maryna Brodina

Your error log says "__performHeaderParametersSubstitutions appery.js:1703". Could you give us steps to reproduce?


Service error: Object [object Array] has no method 'replace'

Posted: Thu Nov 28, 2013 10:06 pm
by Bożena Garbińska

Well, it happens when I try to invoke mapping called like this:

"restservice_Artrequest_update"

This mapping is based on the following REST service:

"foodDB_Art_requests_update_service"

The mapping is in the popup page called "RequestProcessing".

You can try the following diagnostic path inside my app:

1) Open the app
2) On the start page expand the collapsible called "Opcje"
3) Toggle the option called "Opcje administatora" so it is swithed to "Tak"
4) There will be a login box. Enter the following:
login: appery
password: test
5) Confirm by clicking the first button "ZALOGUJ".
6) Go to the second page called "Baza"
7) On that page there is only one input. Enter there any text you wish, like "blahblah" and press the button underneath called "Proponuj"
8) There should be a quick popup saying your request was submited
9) Below is the collapsible called "Propozycje artykułów" You should be able to see there what you have entered in step 7. Click on it.
10) There will be a dialog called "Propozycja". Check the first option on the list and then the button at the bottom of this dialog - it invokes the service that fails.

I know it might not be easy to reproduce so let me know if there are any problems with this path.


Service error: Object [object Array] has no method 'replace'

Posted: Fri Nov 29, 2013 3:04 am
by Branden

Just for the record, I too am experiencing the same problem. My app was working as expected, then Appery applied some patches, and it hasn't worked since.

That was the second time my app mysteriously stopped working.


Service error: Object [object Array] has no method 'replace'

Posted: Fri Nov 29, 2013 3:44 am
by Alena Prykhodko

Hi Bożena! Working on it...


Service error: Object [object Array] has no method 'replace'

Posted: Fri Nov 29, 2013 3:46 am
by Alena Prykhodko

Hi Branden! Please show us screen shots and describe the problem more detailed.


Service error: Object [object Array] has no method 'replace'

Posted: Fri Nov 29, 2013 9:29 am
by Serhii Kulibaba

Hello Bożena,

We just fixed your application, try it.


Service error: Object [object Array] has no method 'replace'

Posted: Fri Nov 29, 2013 5:54 pm
by Bożena Garbińska

Hello Sergiy
It is WORKING now. Thank you very much. Guys I really appreciate your responsiveness and expertise.