IBM / zowe-cli-cics-deploy-plugin

Provides the cics-deploy plug-in for Zowe CLI https://github.com/zowe/zowe-cli to deploy Node.js and other applications from a workstation to IBM CICS Transaction Server within a CICS bundle. Documentation is available at https://ibm.github.io/zowe-cli-cics-deploy-plugin/
Eclipse Public License 2.0
13 stars 12 forks source link

Cryptic error message with zosmf server is not available #103

Closed markcocker closed 5 years ago

markcocker commented 5 years ago
zowe cics-deploy push bundle --name Express --targetdir /u/cicprov/mnt/CICPY000/bundles --overwrite --verbose
Making remote bundle directory '/u/cicprov/mnt/CICPY000/bundles/myexpressapp_1.0.0'
Command Error:
A failure occurred during CICS bundle pushing.
 Reason = Unexpected token E in JSON at position 0

~/.zowe/zowe/logs/zowe.log shows:

[2019/04/29 13:11:20.356] [DEBUG] [BundleParent.handler.js:50] Arguments received by cics-deploy: {"cicsplex":"ZOSPTINT","cp":"ZOSPTINT","scope":"CICPY000","sc":"CICPY000","csdgroup":"NODE","cg":"NODE","cicshlq":"ANTZ.CICS.TS.DEV.INTEGRAT","hlq":"ANTZ.CICS.TS.DEV.INTEGRAT","cpsmhlq":"ANTZ.CICS.TS.DEV.INTEGRAT","cphlq":"ANTZ.CICS.TS.DEV.INTEGRAT","jobcard":"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT","jc":"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT","_":["cics-deploy","push","bundle"],"verbose":true,"v":true,"overwrite":true,"ow":true,"name":"Express","n":"Express","targetdir":"/u/cicprov/mnt/CICPY000/bundles","td":"/u/cicprov/mnt/CICPY000/bundles","$0":"zowe","targetstate":"ENABLED","ts":"ENABLED"}
[2019/04/29 13:11:20.425] [DEBUG] [ZosmfSession.js:26] Creating a z/OSMF session from the profile named %s
[2019/04/29 13:11:20.427] [DEBUG] [SshSession.js:44] Creating a z/OS SSH session from the profile named %s
[2019/04/29 13:11:20.429] [DEBUG] [BundlePusher.js:372] Making remote bundle directory '/u/cicprov/mnt/CICPY000/bundles/myexpressapp_1.0.0'
[2019/04/29 13:11:20.447] [DEBUG] [AbstractRestClient.js:92] will write data for request
[2019/04/29 13:11:20.448] [DEBUG] [AbstractRestClient.js:97] writing JSON for request
[2019/04/29 13:11:20.648] [DEBUG] [AbstractRestClient.js:272] onEnd() called for rest client ZosmfRestClient
[2019/04/29 13:11:20.649] [DEBUG] [ZosmfRestClient.js:70] Encountered an error trying to parse causeErrors as JSON  - causeErrors is likely not JSON format
[2019/04/29 13:11:20.650] [DEBUG] [AbstractRestClient.js:352] Error was processed by overridden processError method in RestClient ZosmfRestClient
[2019/04/29 13:11:20.651] [ERROR] [BundleParent.handler.js:72] A failure occurred during CICS bundle pushing.
 Reason = Unexpected token E in JSON at position 0
pcoop commented 5 years ago

It sounds like something went wrong in Zowe's underlying Create.uss() call. The key line of output seems to be this one:

[ZosmfRestClient.js:70] Encountered an error trying to parse causeErrors as JSON - causeErrors is likely not JSON format

I suspect that something that's expecting to receive an ImperativeError instead received garbage, rethrew it, and that caused a similar problem higher up the stack.

pcoop commented 5 years ago

I suspect our code isn't being as tolerant of weird responses from Zowe APIs as it could be. I've noted that when an Error is caught the cause is usually set to an Object, but it's sometimes a stringified version of that Object, and sometimes to a plain old string. I'll add some code to try and cope with each variation out of Create.uss() rather than assuming consistency.

markcocker commented 5 years ago

Thanks. As our z/OSMF server was restarted, I had to recreate the error by creating a new z/OSMF profile with an invalid port. The symptoms look the same and the error message is much better now Problem is: z/OSMF REST API Error: http(s) request error event called Error: connect ECONNREFUSED 9.20.5.0:65000.

Console

zowe cics-deploy push bundle --name INVOKE --targetdir /u/cicprov/mnt/CICPY000/bundles --overwrite --zosmf-p invalid
Command Error:
A failure occurred during CICS bundle pushing.
 Reason = A problem occurred attempting to create directory '/u/cicprov/mnt/CICPY000/bundles/cics-nodejs-invoke_1.0.0'. Problem is: z/OSMF REST API Error:
http(s) request error event called
Error: connect ECONNREFUSED 9.20.5.0:65000