Start a new topic
Answered

Endpoint not working

 I'm having an issue with one of my Kinvey App projects, all my endpoint calls are receiving the same error since this morning:


{
  "error": "BLSyntaxError",
  "description": "The Business Logic script has a syntax error(s). See debug message for details.",
  "debug": "SyntaxError: Unexpected token >"
}


Note that there were no changes in the business logic, it just stopped working for that app in specific.


Best Answer
Andres,

Yes, You are right. I am glad you are able to solve this issue. I would like to share response from our engineering with you.

Response from engineering is as follows:

"For Business Logic, we compile the common code first, followed by the specific endpoint or hook that is being invoked. In this case, the user's common code had a bug, so every Business Logic function would be subject to this error. The error was in the GCM common code file, with the following line:

f (Webdevices.findIndex(Webdevice => Webdevice.mac == SDKdevice.mac) === -1) WebregIDs.push(Wdevice.registrationID);


The => is a language feature of ES6, which Business Logic does not currently support. So this threw a syntax error.

The common code Business Logic was changed several times over the last few days"



Thanks,
Pranav
Kinvey

 


Answer
Andres,

Yes, You are right. I am glad you are able to solve this issue. I would like to share response from our engineering with you.

Response from engineering is as follows:

"For Business Logic, we compile the common code first, followed by the specific endpoint or hook that is being invoked. In this case, the user's common code had a bug, so every Business Logic function would be subject to this error. The error was in the GCM common code file, with the following line:

f (Webdevices.findIndex(Webdevice => Webdevice.mac == SDKdevice.mac) === -1) WebregIDs.push(Wdevice.registrationID);


The => is a language feature of ES6, which Business Logic does not currently support. So this threw a syntax error.

The common code Business Logic was changed several times over the last few days"



Thanks,
Pranav
Kinvey

 

Hi Pranav,

I solved the issue, I had a lambda expression in a common code function:
Webdevice => Webdevice.mac == SDKdevice.mac

The thing is that the editor didn't throw an error or even a warning in the line where the expression was so I didn't know where was the issue or that the compiler couldn't work with this type of code.

Andres,

This is really a weird issue. I have escalated it to engineering for further investigation and will keep you posted on the progress.

Thanks,
Pranav
BACK-2747

 

Hi Pranav,

1. The only one that seems to have the issue is GeoPush.
2. Through API console:

REQUEST
POST /rpc/kid_BkU-FzGQ/custom/error HTTP/1.1
Host: baas.kinvey.com
Content-Type:application/json
Authorization: Basic a2lkX0JrVS1GekdROjlkNGE2YTEyNmRkODQwYzNiNDdhMmEyODVkZGQ5Mzc2
X-Kinvey-API-Version: 3

 RESPONSE

HTTP/1.1 550 unknown
Content-Type: application/json
X-Kinvey-API-Version: 3
X-Kinvey-Request-Id: 0307162193644357b9ea4026f9c61c76
X-Powered-By: Express

{
    "error": "BLSyntaxError",
    "description": "The Business Logic script has a syntax error(s). See debug message for details.",
    "debug": "SyntaxError: Unexpected token >"
}
3. I'm calling the endpoint through HTTP request mainly using node.js request module

Thanks,
Andres
Andres,

That's weird. I am not able to reproduce this issue in my environment.

  1. I noticed you have multiple apps on Kinvey platform. Can you tell me for which app you are seeing this issue?
  2. Can you try calling your custom endpoints through Kinvey API console and see if you get the same issue?
  3. If you are calling custom endpoint through SDK then can you please let me know the name and version of the SDK that you are using?

Thanks,
Pranav
Kinvey

 

Thanks Pranav,
All my endpoints give the same error, endpoints that were working fine starting giving the error without any change.
I created a new endpoint for testing purpose:

function onRequest(request, response, modules) {
  response.complete(200);
}

And this one gives out the same error.

 

Andres,


As per the debug message, there is a syntax error in your business logic code. There is an unexpected token ">" which is causing this issue. Can you please review your code again for ">"?


Thanks,

Pranav

Kinvey

Login or Signup to post a comment