Custom Domo App (Replicating the SugarForce example)

I am trying to replicate the steps of the SugarForce sample code from Vanilla Javascript tutorial. After my initial setup (sample dataset, domo app cli, app initialization and publish), my domo.get command is giving me a 404 error for the following:

domo.get('/data/v2/leads?limit=10')    .then(function(leads){      console.log("leads", leads);    });

Any possible troubleshooting suggestions?

Comments

  • In your manifest file you should have an alias defined which is mapped to a specific dataset. You'll want to make sure you're using that alias instead of leads

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • sourabh05
    sourabh05 Member
    edited September 30

    Thanks for the suggestion, @GrantSmith. I do have the alias 'leads' setup in the manifest as per the instructions.

    "datasetsMapping":[

    {

    "dataSetId": <ID>,

    "alias": "leads",

    "fields": []

    }

    ],

    Although, when I was comparing the code published on that tutorial I can see that Domo.js was missing in my setup. I am assuming that when I loaded the SugarForce template, for reason, It didn't bring the domo.js module. I tried to manually copy-paste the file from the code but that is not working as well.

    I have a feeling this domo.get error has something to do with my incorrect domo.js setup. But, I do not know how to correctly set it up instead of just copy pasting the code.

  • Try /data/v1/leads instead of /data/v2/leads

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • same error with the v1

  • sourabh05
    sourabh05 Member
    edited September 29

    I tried installing domo,js as per instructions here: https://developer.domo.com/portal/e947d87e17547-domo-js

    And I see that the ryuu.js package was installed but no domo.js still

    (updated): I see that Domo.js is now part of the installed package.

  • I tried running on my local dev instance to eliminate the permissions issue with the company instance.. but the same error with the local dev instance

  • also, I got the same get request error for the second tutorial 'Return Flow'

  • Added Embed authorization to the localhost (although, I don't think this should matter), to no avail

  • Added token authorization, still no bueno

  • @sourabh05 I see two issues:

    1.) You have "datasetsMapping", while the code requires "mapping".

    2.) You have "DataSetId", while the code requires "datasetId".


    Here is an example from some of my existing app that I wrote last week (however this is for a react app; not a vanilla JS. Meaning that there are possibly differences I am not accounting for).

    Hope this solves your issue^!

    ** Was this post helpful? Click 💡/💖/👍/😊 below. **
    ** If it solved your problem. Accept it as a solution! ✔️ **

    Or do you need more help? https://calendly.com/matthew-kastner/15-minute-chat
    Did I help you out? Feedback is priceless and will help me more than you know.Write a review!

  • Hi @MattTheGuru - Thanks for your feedback. Those attributes were created by the SugarForce template but in any case, I tried changing those to what you mentioned above and that still does not work.

  • MattTheGuru
    MattTheGuru Contributor
    edited September 30

    Oh wait, @sourabh05 the issue is because you are running it locally and there is no server located at http://localhost:3000/domo/data/v2/leads?limit=10" to accept that request.

    Try pushing it up to your actual instance of Domo and running it there with automatically switch from trying to hit "http://localhost:3000" to Domo's local server. Push your code up and it will work.


    If you want it to work locally then you need to have the the proxy set up (is this your actual question?)

    ** Was this post helpful? Click 💡/💖/👍/😊 below. **
    ** If it solved your problem. Accept it as a solution! ✔️ **

    Or do you need more help? https://calendly.com/matthew-kastner/15-minute-chat
    Did I help you out? Feedback is priceless and will help me more than you know.Write a review!

  • sourabh05
    sourabh05 Member
    edited September 30

    yes, I want to run it locally (in the dev instance using domo dev CLI command) before I release the app to the Domo instance. I was thinking about setting up a proxy but all the documentation says that proxy is only needed for the AppDB not for the Data APIs.

  • @sourabh05 I have always used the proxy when working locally, but you can always "redeploy" to the exact same app in the Domo instance using the "id" in the manifest.

    ** Was this post helpful? Click 💡/💖/👍/😊 below. **
    ** If it solved your problem. Accept it as a solution! ✔️ **

    Or do you need more help? https://calendly.com/matthew-kastner/15-minute-chat
    Did I help you out? Feedback is priceless and will help me more than you know.Write a review!

  • @MattTheGuru your suggestion worked! It needed a proxy and as soon as I added that I am able to successfully retrieve the object through get method.

    So apparently proxy is needed for both AppDB and Data APIs. And I am able to do this in the local dev server. Thank you!!