Digital Assistant and Mobile

Get Involved. Join the Conversation.

Comments

  • Chris Muir

    Please advise the SR number.

    CM.

  • Jijo Joshi

    It's a paid customer account. We have raised an SR for this as the development roles assigned seems to be appropriate.

  • Chris Muir

    Thanks for the information. To be honest I'm not sure, and am seeking advice.

    Can you please advise is this a trial account, or a paid customer account?

    CM.

  • Jijo Joshi

    In My Services - Dashboard, i am able to view the development environmentScreenshot_19.jpg

  • Jijo Joshi

    Hi Chris,

    I have tried logging again after clearing the browser cache and also in incognito window (private browser) and still facing the same. Here's the error captured using developer tool option in browser (attaching the screenshot).Screenshot_18.jpg

  • Chris Muir

    That is very odd, I've not seen similar behaviour to this.

    Firstly can you try flushing your browser cache, totally close down your browser, then retry?

    Another possibility, do not go straight the MCS UI with any bookmarked URL.  Rather clear your cache, restart your browser, and first access the Oracle Public Cloud My Services dashboard, then the Mobile Environment Service, then click on Open Console.

    Finally if the error still occurs, with your browser, can you open the Developer Tools, and attempt to capture any errors that are being raised please?  Anything that may give us a hint of what's going on.

    If we can't resolve that, assuming you're a paid customer, we may need you to lodge an SR with Oracle support.

    Regards,

    CM.

  • Chris Muir

    There is no current debugger.  Your best solution at this time is to include console.log calls and you can view them in the MCS diagnostics.

    CM.

  • Anand Raj

    @Chris Muir-Oracle

    Just want to know , is there any way to debug the code other than using console?

  • Anand Raj

    Thank you . Now i understood .

  • Chris Muir

    When you build MCS custom APIs, you both build their endpoints in the design section, and then you write code in NodeJS for each endpoint.

    So in the designer you might build endpoints like:

    GET /custom/mobile/blah/x

    GET /custom/mobile/blah/y

    GET /custom/mobile/blah/y/someValue

    When you generate and modify the NodeJS scaffold code for the first time, you should have code similar to:

    #1 service.get('/custom/mobile/blah/x', function(req, res) { etc }

    #2 service.get('/custom/mobile/blah/y', function(req, res) { etc }

    #3 service.get('/custom/mobile/blah/y/:someParam', function(req, res) { etc }

    As such if you invoke GET /custom/mobile/blah/x #1 will be called.

    If you invoke GET /custom/mobile/blah/y #2 will be called

    If you invoke GET /custom/mobile/blah/y/someValue) #3 will be called.

    **Note** for the last one, if you omit the parameter value someValue, #2 will be called.

    In fact Express expects #2 to be defined in your list of functions.  It will not pass the call to #3 with deviceType == null.

    This is where you've gone wrong.  Using your example when you're calling:

    {baseURL}/mobile/custom/****/deviceVersion

    ...you're expecting the following to be called:

    {baseURL}/mobile/custom/****/deviceVersion/:deviceType

    ...but Express is looking for the following:

    service.get('/mobile/custom/****/deviceVersion', etc)

    In other words, the fact you haven't supplied a deviceType doesn't mean the following is called with deviceType = null:

    service.get('/mobile/custom/****/deviceVersion/:deviceType', etc)

    ...rather Express is looking for the following instead:

    service.get('/mobile/custom/****/deviceVersion', etc)

    As a recommendation, I suggest you review the NodeJS Express documentation on "Routers" to understand how this all works:

    https://expressjs.com/en/guide/routing.html

    CM.

  • Anand Raj

    Sorry to say that i didn't get what you said .

    Endpoint defined in MCS is deviceVersion/{deviceType}

    I am getting right response when i pass the deviceType along the Url . Issue comes only if when we invoke the url  without deviceType

  • Chris Muir

    Right, I understand.  So you're calling the following URL endpoint via a GET:

    {baseURL}/mobile/custom/****/deviceVersion

    ...without a further value such as:

    {baseURL}/mobile/custom/****/deviceVersion/blah

    Why Express is complaining is you haven't defined a handler for the former URL pattern (or at least you haven't copied the code into this post).  As such your code within the handler is never getting called.

    If you are going to raise queries that hit URLs at the former endpoint, you need to also define that endpoint in the MCS custom API designer.


    CM.

  • Anand Raj

    Thanks for your time and reply .

    • As you mentioned above I have tried using if (reqParams.deviceType == null || reqParams.deviceType === "") . But I am getting the same error that i mentioned above .
    • The "deviceType" parameter is String.
    • ( As for the error code you're receiving, I'm guessing that is raised by your call to commonHandler.CommonHandlerGetMethodFunction as your current if statement I'm guessing is failing the test deviceType == '{}' and failing through to the else statement.  I think that error is a red herring to what you're trying to solve in this forum thread.)

             Reply for your above point . When i comment (//) the "else" statement i am also getting the same error . when i invoke api without the parameter deviceType , it shows that there is no such Url /mobile/custom/******/deviceVersion/ . I think MCS expects a value after deviceVersion/<> .

  • Chris Muir

    I assume the 6 stars (******) in your examples is where you have deliberately obfuscated your custom API name for some reason.

    In considering the parameter I'm assuming deviceType is a string?  As such have you tried the following to check if the parameter String is null?:

    if (reqParams.deviceType == null || reqParams.deviceType === "")

    As this is 101 JavaScript syntax I can only assume you've tried this and it didn't work for you.  Can you elaborate what your testing for the above statement returned please?

    As for the error code you're receiving, I'm guessing that is raised by your call to commonHandler.CommonHandlerGetMethodFunction as your current if statement I'm guessing is failing the test deviceType == '{}' and failing through to the else statement.  I think that error is a red herring to what you're trying to solve in this forum thread.

    CM.

  • Sorin Dragomir

    Please check prices for cloud notification here:

    https://cloud.oracle.com/en_US/messaging/pricing

    Cheers