Giter VIP home page Giter VIP logo

Comments (8)

AutomataVM avatar AutomataVM commented on August 15, 2024 1

it really was, thank you so much! I'll close the issue!

from node-sdk-core.

germanattanasio avatar germanattanasio commented on August 15, 2024

You need to allow for 2 requests.

  1. First goes to https://iam.cloud.ibm.com/identity/token and retrieves an access_token (this is where you app is failing)
  2. Second goes to https://gateway.watsonplatform.net/conversation/api

Both are https. In your error, I see https://https://... which should not be there.
Can you paste the code you are using to construct the service instance?

from node-sdk-core.

AutomataVM avatar AutomataVM commented on August 15, 2024

sure! Here it is :

const { WatsonMiddleware }  = require('botkit-middleware-watson');

 const watsonMiddleware = new WatsonMiddleware({

        iam_apikey: process.env.WATSON_APIKEY,
        url: process.env.WATSON_URL,
        workspace_id: process.env.WATSON_WORKSPACE_ID,
        version: '2018-07-10',
        minimum_confidence: 0.5, // (Optional) Default is 0.75
    });

watsonMiddleware.before = async (message, payload) => {

        if (typeof(payload.context) === 'undefined') {
            var context = {
                context: {
                    user_id: userId.user_id,
                    name:userId.name,
                    prev_interview: '',
                    prev_interview_detail: '',
                    age: '',
                    place: '',
                    civil_state: '',
                    prev_studies: '',
                    time_availability: '',
                }
            };

            Object.assign(payload, context);
        }

        return payload;
    };

contents of the .env file

WATSON_APIKEY=apikey goes gere
WATSON_URL=https://gateway-lon.watsonplatform.net/assistant/api
WATSON_WORKSPACE_ID=workspace id goes here

from node-sdk-core.

AutomataVM avatar AutomataVM commented on August 15, 2024

Update: I changed it so now the https part is not repeated, but still get the same error. I am guessing it's because it can't be reached from the server, but I'm not sure. I can ping from my computer just fine.

image

image

from node-sdk-core.

germanattanasio avatar germanattanasio commented on August 15, 2024

based on your images, the error is in the token request to IAM, not in the call to Watson. Try following the tutorial here https://cloud.ibm.com/docs/iam?topic=iam-iamtoken_from_apikey and see if you can do a curl command and get a token back

from node-sdk-core.

AutomataVM avatar AutomataVM commented on August 15, 2024

Hello there! I followed the tutorial and got the exact same results as the expected answers:

{"access_token":"long string",
"refresh_token":"long string",
"token_type":"Bearer",
expires_in":3600,
"expiration":1574269358,
"scope":"ibm...

but it is still not working. Never once with botkit I had to send a curl btw. It just works once I execute the command npm start on my local machine
.

from node-sdk-core.

AutomataVM avatar AutomataVM commented on August 15, 2024

I tried changing the proxy settings of watsonmiddleware, but I get this as currenturl

_currentUrl: 'https://host:port/https://iam.cloud.ibm.com/identity/token'

is this okay? how should I change it?

from node-sdk-core.

dpopp07 avatar dpopp07 commented on August 15, 2024

@juanpablo64 Have you tried this method described in the docs? It seems like your issue is with the proxy, this may be what you need to fix it

from node-sdk-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.