Search code examples
node.jsibm-watsonwatsonwatson-conversation

Error: The app has not been configured with a WORKSPACE_ID environment variable


I've changed the workspace ID in both my env file as well as my app.js file just in case. I've installed all the necessary SDK's and have done everything according to the instructions here.

I swapped out the workspace files with my own workspace. But I made all the necessary changes including changing the workspace ID. Not quite sure why i'm still getting the error. Any help would be much appreciated!

Edited: Here are the changes I made to my code

Image


Solution

  • I had the same problem a few days ago. And, to solved this, you can paste the WORKSPACE_ID in this line too!

    But, if you want use the .env file, make sure the are no spaces between = and the end of the line.

    I will put the print of my app.js as an example to help you:

    enter image description here

    Actually, both ways work.

    My example show this:

      username = "<iwdiaowd-jioawjd-ioajgr-ogxgxajofa>" 
      password = "<xxxxxxxxxxxxxxxxxxxx>"  
    
      var workspace = "<59583409583495834590385394>"`
    

    Try edit your .env:

    WLP_SKIP_MAXPERMSIZE=true
    VCAP_SERVICES={"conversation": [{"name": "conversation-service","label": "conversation","plan": "free","credentials": {"url": "https://gateway.watsonplatform.net/conversation/api","isStreaming": false,"password": "-ReplaceMe-","username": "-ReplaceMe-"}}]}
    COLLECTION_NAME=workspace
    WORKSPACE_ID=iwdiaowd-jioawjd-ioajgr-ogxgxajofa
    LOGGING_ENABLED=false