Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PreFlowError running API Connect v5.0.8.0 (apiconnect v2.7.28) Microgateway #87

Open
kevinom opened this issue Sep 19, 2017 · 25 comments
Open

Comments

@kevinom
Copy link

kevinom commented Sep 19, 2017

When running on the Microgateway, calls to API endpoints fail with the message:
{"name":"PreFlowError","message":"unable to process the request"}

Create a new API with any hardcoded target URL in the Invoke properties.
If you run the Test option from the Designer, it gives the error mentioned above.

@ozairs
Copy link
Collaborator

ozairs commented Sep 20, 2017

The preflow error usually occurs before execution of the API assembly.

Can you run the same request outside of the Test tool within the designer (ie using curl).

Are you sure you have the right clientid, clientsecret, URI (remember that incoming API is combination of base_path + API).

@sunnygoel8
Copy link

Hi @ozairs ,

I'm getting same issue while running api locally on MicroGateway. Tested via. Soap UI, Postman, curl but same result. Verified Client id, secret, URI etc. and everything looks fine.

Pushed loopback application & related product on Bluemix. Working fine there because it's running on DataPower gateway..

@jgeddes2001
Copy link
Contributor

@kevinom I tried the scenario you describe.. seems to work for me based on current code I get from npm install -g apiconnect..
Can you include the swagger you are using?

@kevinom
Copy link
Author

kevinom commented Sep 21, 2017

Hi Jeremy - here is the YAML file - had to ZIP it because it doesn't let me upload .YAML
savings_1.0.0.zip

@jgeddes2001
Copy link
Contributor

yeah.. Something is different about our environments.. I can't seem to recreate the problem using your swagger in my env..

https://localhost:4002/savings/Plans/estimate
returns:

{
  "balance": 8933.42
}

@kevinom
Copy link
Author

kevinom commented Sep 21, 2017

Are you perhaps running with the IBM SDK for Node.js?
I get the preflow error running apiconnect 2.7.28 on two systems:
One with node v4.6.1 & npm 4.4.4
The other with node v6.11.3 & npm 3.10.10
Both running on Ubuntu 14.04.4 LTS trusty.

@jgeddes2001
Copy link
Contributor

So, I played around some more and realized I hadn't really updated apiconnect correctly to:

$ apic --version
API Connect: v5.0.8.0 (apiconnect: v2.7.28)

I was able to recreate the problem Error: api-loader failed to load any API .. and workaround the problem by redoing the npm dependencies..

Work around:

cd /usr/local/lib/node_modules/apiconnect/node_modules/microgateway
rm -rf node_modules
sudo npm i

This is some sort of packaging issue..

Seems like this is related to loopbackio/loopback-datasource-juggler#1467

@kevinom
Copy link
Author

kevinom commented Sep 22, 2017

The workaround worked for me.
Thanks a lot Jeremy.

@sunnygoel8
Copy link

Thanks @jgeddes2001 .. It's working fine for me as well.

@jgeddes2001
Copy link
Contributor

Great!.. I'm still chasing what changes need to be made on the apiconnect shrinkwrap to line up with microgateway's dependencies.. I have a few suspects, but not there yet..

@kevinom
Copy link
Author

kevinom commented Sep 25, 2017

Hi Jeremy,
Don't know whether this is related to the previous issue, but the Explore option is not letting me POST a note in the sample notes application that come with Loopback/API Connect.
When I run Try it with generated data on a POST https://localhost:4002/api/Notes, it returns a 422 error:
{
"error": {
"statusCode": 422,
"name": "ValidationError",
"message": "The Note instance is not valid. Details: id can't be set (value: 40.39781222).",
"details": {
"context": "Note",
"codes": {
"id": [
"absence"
]
},
"messages": {
"id": [
"can't be set"
]
}
},
"stack": "ValidationError: The Note instance is not valid. Details: id can't be set (value: 40.39781222).\n at /home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/dao.js:398:12\n at ModelConstructor. (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/validations.js:567:11)\n at ModelConstructor.next (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/hooks.js:93:12)\n at ModelConstructor. (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/validations.js:564:23)\n at ModelConstructor.trigger (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/hooks.js:83:12)\n at ModelConstructor.Validatable.isValid (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/validations.js:530:8)\n at /home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/dao.js:394:9\n at doNotify (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at Function.ObserverMixin._notifyBaseObservers (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:178:5)\n at Function.ObserverMixin.notifyObserversOf (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n at Function.ObserverMixin._notifyBaseObservers (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)\n at Function.ObserverMixin.notifyObserversOf (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n at Function.ObserverMixin._notifyBaseObservers (/home/student/samples/notes/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)"
}
}

@jgeddes2001
Copy link
Contributor

@kevinom think that's coming from your actual app.. not related to microgateway.. Sounds like your datatypes aren't lining up..

@sjc-code
Copy link

sjc-code commented Oct 5, 2017

@rickchoi
Copy link

I still experience this issue even in v2.7.30, and the workaround shared by @jgeddes2001 (redoing npm dependencies in microgateway modules) works well. I'm just wondering why this issue's not even resolved in the newly released version and there's no official announcement or notes from product team for the issue..

@KarimPanni
Copy link

@jgeddes2001 is there a reason the workaround you provided would not work on windows 10?

Work around:

cd /usr/local/lib/node_modules/apiconnect/node_modules/microgateway
rm -rf node_modules
sudo npm i

@jgeddes2001
Copy link
Contributor

@KarimPanni I'm guessing if the workaround doesn't work on your windows 10 in your environment is one of three things..

  1. windows' directory structure puts global npm modules in a different location.. https://stackoverflow.com/questions/33819757/global-npm-install-location-on-windows
  2. npm version difference?
  3. different problem?

@smartmouse
Copy link

This issue should be resolved with APIConnect v5.0.8.1 and microagteway 1.6.6.

@sunnygoel8
Copy link

Hi @jgeddes2001 ,

I'm facing the same issue with API Connect v 5.0.8.3 I tried the workaround you mentioned above in this thread but that didn't work for me. Here's the NPM and Windows version, I'm running on my machine.

Could you please help me fix this issue ? Thanks.

npm v 5.6.0
Windows 10 Enterprise

@saywow
Copy link

saywow commented Jun 1, 2018

we have not yet support npm v5.6.x in API Apiconnect v.5.0.8.3.
We support node 6.x and npm 3.x only

@sunnygoel8
Copy link

sunnygoel8 commented Jun 1, 2018

@saywow , Thanks for your response. It means, I'll need to downgrade the Node and npm version on my machine. I'll give it a try and let you know how it goes..

Btw, when will it start supporting the latest version of node and npm? Any idea ?

@smartmouse
Copy link

Tentatively in next up coming release. Which node version are you using? Node 10.x or just node 8.x ?

@sunnygoel8
Copy link

Hi @smartmouse ,

I was using 8.x , downgraded that to v 6.x and tried installing the APIc toolkit afterwards. But install itself is failing now. So I'm thinking to upgrade node version back to 8.x (which comes by default with npm 5.6) and then will try to install APIc toolkit again..

@asraro
Copy link

asraro commented Aug 17, 2018

Getting the same error when i run the curl command:

C:\Windows\system32>curl --request POST --url https://localhost:4002/api/Notes --header 'accept: application/json' --header 'content-type: application/json' --header 'x-ibm-client-id: default' --heade
r 'x-ibm-client-secret: SECRET' --data '{"title":"abucanun","content":"deto","id":30.63861523}' -k
{"name":"PreFlowError","message":"unable to process the request"}curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: default'
curl: (6) Could not resolve host: SECRET'

Here's my version:

C:\Windows\system32>apic -v
API Connect: v5.0.8.4-iFix (apiconnect: v2.8.29)

C:\Windows\system32>npm -v
6.4.0

C:\Windows\system32>node -v
v8.11.3

@No9
Copy link

No9 commented Aug 27, 2018

Hi @asraro
From the error message that looks like curl isn't parsing your command properly

curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: default'
curl: (6) Could not resolve host: SECRET'

Are you using git bash environment to execute curl?

@jeanabraham
Copy link

Folks,

I getting the same error:

// https://127.0.0.1:4002/
{
  "name": "PreFlowError",
  "message": "unable to process the request"
}

I already tried without success:

cd /usr/local/lib/node_modules/apiconnect/node_modules/microgateway
rm -rf node_modules
sudo npm i

Here are the versions that I'm using:

jean:apic$node -v
v8.15.0
jean:apic$npm -v
6.4.1
jean:apic$apic -v
API Connect: v5.0.8.5 (apiconnect: v3.0.17)
jean:apic$

Any help would be appreciated? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests