Support Topics Documentation Slack YouTube Blog

Codeless response missing in console on invocation


(Renato N) #1

Hi again - I noticed some intermittently strange behavior in console.

When I try to invoke a codeless function, the response tab is often blank:
http://support.backendless.com/public/attachments/e006f9d1e4b04df928db8593d2c2d922.png</img>

I know the request has completed, because the response header shows that, and the “test drive” tab in the editor does actually show the history, in this case the error I am running into:
http://support.backendless.com/public/attachments/02c17a0949dd110e69eef49f0f47db0b.png</img>

http://support.backendless.com/public/attachments/ecc8f535181cebc17a6a1c7bf0001693.png</img>

Renato

ecc8f535181cebc17a6a1c7bf0001693.png

e006f9d1e4b04df928db8593d2c2d922.png

02c17a0949dd110e69eef49f0f47db0b.png


(Mark Piller) #2

Hi Renato,

What if you look in the Network tab of the browser’s developer tools? When you invoke a service from Backendless console, the invocation is a REST request sent by the browser, so you will see it there. Please check and see what it shows.

Regards,
Mark


(Renato N) #3

Hi Mark,

It looks to be returning a 400 bad request, with this as a response:

{ 
"code" : 0,
"message" : ""
}

Not sure if related or not, but there seems to be some react errors in the debugger, which maybe could explain why the response doesn’t show in console?

http://support.backendless.com/public/attachments/813c477dac3a71723c7cb13742f6dd5e.png</img>

I’m basically trying to execute a DELETE request against mailchimp (tested and working in postman), but for whatever reason, when executed in backendless, it fails with a bad request, with no kind of contextual error.

Any suggestion?

Thanks,
Renato


(Mark Piller) #4

I recommend taking a look at the code created for your codeless program and see if there are any obvious (and not so) errors in it.


(Renato N) #5

Mark,

Two things:

a) While trying to do some more debugging, I came across this error when trying to click the deploy button:
http://support.backendless.com/public/attachments/ef5783729be8ac1f90908b456500c9f3.png</img>
Would you be able to see if it provided any context?

b) I was trying to use the logger block to see if I could gain some more context on the issue, and no logs are being saved to the log file in Console > Manage > Log Management > Files > {Today’s date}.

Byte size for the file shows 1024, and is an empty file. I’m sure this was working the other day, as I was able to see my previous output logs in there.

As for your suggestion, there doesn’t seem to be much glaring out at me, logic and (translated) code wise. I currently have a codeless function (where the external HTTP request logic sits), which is then called in my service function. I thought I would try and re-create the request call directly in the service (since it seems the response is not passed correctly), and that’s when I hit the error above when trying to deploy.

Renato

ef5783729be8ac1f90908b456500c9f3.png


(Renato N) #6

Mark,

After that error came up, I just noticed that the ENTIRE codeless service I had (multiple service functions) is now gone from console!

Please tell me you have some kind of backup so there is some way to restore to before the exception came up!!?

Renato


(Mark Piller) #7

Hi Renato,

Do you see an .xml file in the CODING section if you select the codeless model there?

Regards,
Mark


(Renato N) #8

Hi Mark, Yes, I see it in the model under the codeless tab …
An .xml file for each of my service functions, and a single index.js file? Is that correct?


(Mark Piller) #9

Yes, that’s good. The data is not lost.

We’re working on a nasty bug which deregisters a service if it contains any errors in the resulting JS. Once the bug is fixed, we will be able to “re-wire” your service so it shows up in the app.

Regards,
Mark


(Renato N) #10

That makes total sense - I did notice that index.js file had some kind of syntax error in the generated JS. To test, I commented out the line, saved the JS in the coding tab (did not know I could do that in console!!) and deployed, and the service showed up.

Thanks Mark!


(Mark Piller) #11

Awesome! If we had a badge system, that would certainly get you a big one… Maybe we should gamify Backendless? :slight_smile:


(Renato N) #12

hahaha I’m all for it, and certainly don’t mind logging the issues I come across :slight_smile:

Also, that issue where text logs are not being committed, would that be related to the above bug?


(Mark Piller) #13

No logging issue is something else. Try using the “print” block, it will send text logs to the log file as well.


(Renato N) #14

hmm just tried that out as well, and seems to be doing the same. I created a very simple GET function in a test service (whose responsibility is simply the print out) and logs still seem to not be produced. I have all of the log levels set to “DEBUG” in console as per the documentation?


(Mark Piller) #15

what if you navigate in console to Files > \logging and open the file in there? Do you see any log messages then?


(Renato N) #16

That’s where I have been looking the last few hours … the odd thing is that there now are logs from before that have populated. I didn’t realize that there would be some kind of delay for them to show up in the file. Odd, but I guess its resolved nonetheless.

Thanks.