Closed marinaalens closed 7 years ago
I think for running locally you need to make sure your .env if filled out appropriately. When run on bluemix, you can bind the services to your app via your manifest file, but locally the manifest doesn't do this as it doesnt have access to the bluemix bindings.
Hi, I checked the .env file and the credentials are all correct. I am also logged using cf login when starting the app locally - I can't understand why it's not working :(
Im really not an expert here, but you may want to just hardcode your stuff in app.js and ignore service binding/yml/env.
this wont cause any problems unless you plan on switching out service instances later on.
didnt mean to close that
I tried hardcoding too - I also thought that might solve it, but no luck. Is there any other workaround that would prevent me from having to push the app every time I make changes? Can it be something with the portnumber? Really hope we can find a solution.
what are you changing? also, can you just outline the steps you are taking to run locally? Its really just navigate to the right place, run npm install, and npm start assuming all your creds and workspace_id is there.
Hi @marinaalens - did you try running npm install
and then npm start
at command line? To run locally, you just need to add your creds to .env and then run those two commands. The cf commands are used to deploy to bluemix.
I ran npm install then npm start and navigated to localhost:3000 in my browser. The app is showing on the screen but with the following error in the console: Failed to load resource: the server responded with a status of 401 (Unauthorized)
Then I tried writing all the authorization code in app.js (hardcoding username, password and wordspace id). Again, npm start and then the error says: POST http://localhost:3000/api/message 401 (Unauthorized) sendRequest @ api.js:59
To be even more specific, here is the error message from the api call to watson (and yes, my username and password really is correct, I promise! :-): {"code":401,"error":"Not Authorized","description":"2017-05-31T15:20:11-04:00, Error ERCDPLTFRM-DNLKUPERR occurred when accessing https://gateway.watsonplatform.net/conversation/api/v1/workspaces/--WORKSPACE ID--/message?version=2017-05-26, Tran-Id: gateway-dp02-179127930 - Invalid UserId and/or Password. Please confirm that your credentials match the end-point you are trying to access. A common error is trying to use credentials from an experimental or beta release against a GA release or vice versa"}
Hmm. Sorry I missed the first bit about getting an empty ui. I'm not sure what release you're using, but given the error perhaps you somehow instantiated the experimental or beta conversation instance? What's the url listed with your credentials?
You can confirm that you make calls to your workspace using the curl commands from the API to start - that way you don't have to worry about there being an issue with the deployment. https://www.ibm.com/watson/developercloud/conversation/api/v1/
The URL listed with my credentials is: https://gateway-fra.watsonplatform.net/conversation/api Not sure why it's different from the one you posted though..
ah ha! so the sample app is using the US based instance, and you are using the Frankfurt based instance. You will likely need to find the url in app.js? or maybe its buried somewhere in the sdk... and change the url to what you have there rather than whats in the sample app. When you upload to bluemix, it binds it to your app so it must be able to resolve that itself.
It works now! Changed the URL and there you go.... wow a stupid issue. Sorry to have bothered you and thank you both a million times!
No worries. :) Have been there too.
I will actually ask to have this added to the sample app readmes because its not super obvious.
Hi I am creating an app using the conversation-simple as a boilerplate. I have setup the app to use my own conversation instance, and it works beautifully - so thanks for that :-)
However, I cannot run the app locally. That is, when I do it doesn't use my conversation instance, but only shows the empty interface. The console shows an unauthorized error.
I hope someone can help me with this, since pushing the app to bluemix every time I need to see a change is really time consuming! 👎
Bonus question: I am trying to modify the response from watson on the client side, in the method "updateMessage". I am checking if the intent matches a specific string, and if it does I update the response that is returned. But nothing seems to override the response from the server.