watson-developer-cloud / visual-recognition-code-pattern

33 stars 18 forks source link

Unable to run the sample app on my machine #7

Closed PhilippeComte closed 4 years ago

PhilippeComte commented 4 years ago

Hello , I've not been able to run the app on my machine : Can you help ? Thanks in advance ! The app launches ok and disply the default image and its analysis However , it is unable to handle a new image .

When I try to upload an image I get : Internal server error not found

Seems that the connection to to the Watson Service is not established correctly even though the credentials seem correct . More details form the terminal log:

POST /api/classify 500 901.844 ms - 69 { Not Found: Not Found at RequestWrapper.formatError (/Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:208:21) at /Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:196:25 at process._tickCallback (internal/process/next_tick.js:68:7) name: 'Not Found', code: 404, message: 'Not Found', body: '""', headers: { 'content-type': 'application/json', 'content-length': '0', 'cache-control': 'no-cache, no-store', 'content-security-policy': 'none', expires: '0', pragma: 'no-cache', 'strict-transport-security': 'max-age=31536000; includeSubDomains;', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'x-global-transaction-id': '78db223d3b6cc61e2a25fc3b5f99d0c4', 'x-dp-watson-tran-id': '78db223d3b6cc61e2a25fc3b5f99d0c4', 'x-edgeconnect-midmile-rtt': '93', 'x-edgeconnect-origin-mex-latency': '434', date: 'Mon, 16 Mar 2020 12:00:21 GMT', connection: 'close' } } POST /api/classify 500 901.750 ms - 69

mamoonraja commented 4 years ago

Hi @PhilippeComte, thanks for opening the issue. What kind of image did you upload? I just tested the functionality with the bunch of images and it works fine.

PhilippeComte commented 4 years ago

Hi Mamoon

Thanks for answering.

I've downloaded the github repo Changed the service credentials kept the same images (jacket, tets tube, motherboard) then npm install npm run build npn run dev

The app runs locally and display the image and classification for the jacket (is it real or an image ? ).

When I drag one other image into the place where the jacket is , the image is dragged but the classification information is unchanged and I get this internal server error message / not found

Cordialement /Regards Philippe Comte +33 676861847

----- Mail original -----

De: "Mamoon Raja" notifications@github.com À: "watson-developer-cloud/visual-recognition-code-pattern" visual-recognition-code-pattern@noreply.github.com Cc: "Philippe Comte" philippe_comte@laposte.net, "Mention" mention@noreply.github.com Envoyé: Lundi 16 Mars 2020 13:41:41 Objet: Re: [watson-developer-cloud/visual-recognition-code-pattern] Unable to run the sample app on my machine (#7)

Hi @PhilippeComte , thanks for opening the issue. What kind of image did you upload? I just tested the functionality with the bunch of images and it works fine.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or unsubscribe .

PhilippeComte commented 4 years ago

Hi Manoon, It works for me now ! I had left the .env file open in Atom (saved but opened) . I closed it . May be that was the reason Thanks for the assistance

PhilippeComte commented 4 years ago

This time : service unavailable . I have modified the apikey to a non valid value : this gives another message : unable to access because of invalid credentials. I can access the service from Watson Studio and test a custom classifier ... It seems that there is something in the code that creates an internal error : a newer sdk ?

mamoonraja commented 4 years ago

Not sure if I am understanding correctly, but it seems like unable to access because of invalid credentials is a reasonable message since you modified key to be a non-valid value?

PhilippeComte commented 4 years ago

No it was just a trial to see what message I would get with a really invalid apikey : and the message is clear in that case : invalid credentials With the correct apikey I get a message : Internal Server error / service unavailable .

mamoonraja commented 4 years ago

Oh ok, can you check if service URL is correct too?

PhilippeComte commented 4 years ago

Here is the log:

 Server running on port: 5000
{ Service Unavailable: Service Unavailable
    at RequestWrapper.formatError (/Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:208:21)
    at /Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:196:25
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'Service Unavailable',
  code: 503,
  message: 'Service Unavailable',
  body:
   '"<HTML><HEAD>\\n<TITLE>Internal Server Error</TITLE>\\n</HEAD><BODY>\\n<H1>Internal Server Error - Write</H1>\\nThe server encountered an internal error or misconfiguration and was unable to\\ncomplete your request.<P>\\nReference&#32;&#35;4&#46;b6ef3e17&#46;1584375127&#46;3f4aaf04\\n</BODY></HTML>\\n"',
  headers:
   { server: 'AkamaiGHost',
     'mime-version': '1.0',
     'content-type': 'text/html',
     'content-length': '285',
     expires: 'Mon, 16 Mar 2020 16:12:07 GMT',
     date: 'Mon, 16 Mar 2020 16:12:08 GMT',
     connection: 'close' } }
POST /api/classify 500 1761.201 ms - 79
{ Service Unavailable: Service Unavailable
    at RequestWrapper.formatError (/Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:208:21)
    at /Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:196:25
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'Service Unavailable',
  code: 503,
  message: 'Service Unavailable',
  body:
   '"<HTML><HEAD>\\n<TITLE>Internal Server Error</TITLE>\\n</HEAD><BODY>\\n<H1>Internal Server Error - Write</H1>\\nThe server encountered an internal error or misconfiguration and was unable to\\ncomplete your request.<P>\\nReference&#32;&#35;4&#46;257f1cb8&#46;1584375127&#46;4a865d56\\n</BODY></HTML>\\n"',
  headers:
   { server: 'AkamaiGHost',
     'mime-version': '1.0',
     'content-type': 'text/html',
     'content-length': '285',
     expires: 'Mon, 16 Mar 2020 16:12:07 GMT',
     date: 'Mon, 16 Mar 2020 16:12:08 GMT',
     connection: 'close' } }
POST /api/classify 500 1884.082 ms - 79
{ Service Unavailable: Service Unavailable
    at RequestWrapper.formatError (/Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:208:21)
    at /Users/pcomte/Documents/GitHub/visual-recognition-code-pattern/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:196:25
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'Service Unavailable',
  code: 503,
  message: 'Service Unavailable',
  body:
   '"<HTML><HEAD>\\n<TITLE>Internal Server Error</TITLE>\\n</HEAD><BODY>\\n<H1>Internal Server Error - Write</H1>\\nThe server encountered an internal error or misconfiguration and was unable to\\ncomplete your request.<P>\\nReference&#32;&#35;4&#46;337f1cb8&#46;1584378269&#46;feb9ad3\\n</BODY></HTML>\\n"',
  headers:
   { server: 'AkamaiGHost',
     'mime-version': '1.0',
     'content-type': 'text/html',
     'content-length': '284',
     expires: 'Mon, 16 Mar 2020 17:04:29 GMT',
     date: 'Mon, 16 Mar 2020 17:04:29 GMT',
     connection: 'close' } }
POST /api/classify 500 1353.332 ms - 79
{ Service Unavailable: Service Unavailable
mamoonraja commented 4 years ago

Thanks for sharing, it looks like a service issue. Let me try to drag and drop one time. Can you check if clicking on other tiles is working for you or not.

germanattanasio commented 4 years ago

I think it's the URL from the service. Can you run the app with the debug flag for the node-sdk? DEBUG=axios Check the README for the node-sdk

PhilippeComte commented 4 years ago

I have used the info provided in the credentials of my service   "url": "https://gateway.watsonplatform.net/visual-recognition/api", It is a service that predates the normalized naming

PhilippeComte commented 4 years ago

I can access the service and do a classify with Postman

PhilippeComte commented 4 years ago

What do you call debug flaf : --inspect ?

germanattanasio commented 4 years ago

https://

PhilippeComte commented 4 years ago

I've pushed the app to Cloud Foundry with the same behaviour : pc-visual-recognition-code-pattern.mybluemix.net

mamoonraja commented 4 years ago

@PhilippeComte I went back and looked at your env variables and looks like your URL has /api missing, it should be https://gateway.watsonplatform.net/visual-recognition/api

mamoonraja commented 4 years ago

Can you make sure that your URL has /api in the end.

PhilippeComte commented 4 years ago

Hello Thank you for pointing out that /api was not there. Sorry for this .

mamoonraja commented 4 years ago

No worries. Glad it worked!