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

MasheryTool #11

Open
Dikshantbhargava opened this issue Jul 24, 2018 · 26 comments
Open

MasheryTool #11

Dikshantbhargava opened this issue Jul 24, 2018 · 26 comments

Comments

@Dikshantbhargava
Copy link

Hi,

  1. While uploading the WSDL/Swagger file getting mashery init is not a function.

2)Can't set headers after they are sent.

Could you please help on to resolve this error.

Thanks & regards
Dikshant
Masheryinitis not Function.docx
[CantSetheader.docx](https://github.com/mashery/masherytools/files/2222249/CantSetheader.docx
Masheryinitis not Function.docx
)

@rkiesler1
Copy link
Contributor

Newer versions of npm appear to remove the Cox Mashery library from node_modules since it's not available from an NPM repo. I updated the installation instructions to include an extra step that should work around this issue. Please try and report back (you'll need to re-clone first)

@Dikshantbhargava
Copy link
Author

Dikshantbhargava commented Jul 26, 2018

Thanks Rkiesler, for quick response

Now I am using new scripts for mashery tool but while installing, we are getting below error:-
400 Bad Request - POST https://registry.npmjs.org/-/npm/v1/security/audits.
I am using npm version 6.1.0 and node version 6.14.3
Please find the attached screenshot for error.
Could you please assist me in resolving this....

Regards,
Dikshant
BadRequest.docx

@rkiesler1
Copy link
Contributor

rkiesler1 commented Jul 26, 2018 via email

@Dikshantbhargava
Copy link
Author

Dikshantbhargava commented Jul 26, 2018

Masheryinitis not Function.docx
Mainly we are trying to use this tool to move all the api defination from SIT Env to UAT Env by uploading in bulk.

We want to do automation where API defination is created in saas mashery by uploading the swagger file or WSDL file. So we are trying to use this mashery tool to achieve the same. It would be great if you can suggest any other tool for same purpose.

Yes it is working after ignoring the error. Thanks for that! But after uloading the swagger/WSDL file in the UI, the attached error message is being displayed (Mashery init is not a function)
Thanks
Dikshant

@rkiesler1
Copy link
Contributor

rkiesler1 commented Jul 26, 2018 via email

@Dikshantbhargava
Copy link
Author

Yes for swagger import I have created the masheryApi and IO Docs for REST API.

But we are trying to use this mashery tool to move all the api defination from SIT Env to UAT Env by uploading in bulk.(OR we can create API via WSDL also).

@rkiesler1
Copy link
Contributor

rkiesler1 commented Jul 27, 2018 via email

@saurabh12n
Copy link

Hi,

For Copy API tool, I followed all the steps and at the end when I load services from source Area, it is loading all the APIs of my Area but I am unable to type Destination Area as it is showing same as Source area. Then how it will be copy from source area to destination area if we are unable to put destination area name in tool. Can you please help?

@rkiesler1
Copy link
Contributor

You need to specify at least two areas in your credentials.js file, e.g.:

mashery_area_uuids=[
    {
        name: 'my_source_area.mashery.com',
        uuid: 'my_source_area_uuid',
        tm_host: 'src_area_name.api.mashery.com',
        cc_url: 'https://myareaname.admin.mashery.com/control-center'
    },
    {
        name: 'my_target_area.mashery.com',
        uuid: 'my_target_area_uuid',
        tm_host: 'tgt_area_name.api.mashery.com',
        cc_url: 'https://myareaname.admin.mashery.com/control-center'
    }
];

@saurabh12n
Copy link

Thanks for a very quick response. I am amazed with this. Let me try this and I will share you the result .

@saurabh12n
Copy link

I created one trail account in Mashery to test this tool. I tried to copy APIs from my project Area to Mashery Trial account Area. After your suggestion of including two areas (one my project area and one Mashery Trial account area) in my credentials.js, I started Copy APi tool but this time it is not loading service of trail account. My question is whether this tool work on trial account ?

@rkiesler1
Copy link
Contributor

The tool should work on any Mashery account, assuming you have the proper permissions. Are you seeing any specific errors? Try using the developer tools in your browser to see what info/errors the API calls return.

@saurabh12n
Copy link

Yes, I am seeing error as invalid_scope: Invalid scope. I am attaching screen shots while copying file one area to other .
image
image

Also I can see error on command prompt as :

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:561:11)
at ServerResponse.header (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\express\lib\response.js:718:10)
at ServerResponse.send (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\express\lib\response.js:163:12)
at done (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\express\lib\response.js:957:10)
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:93:9
at Object.done (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\async.js:74:20)
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:88:18
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:69:11
at Object.done (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\async.js:74:20)
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:64:20

@rkiesler1
Copy link
Contributor

This appears to be a permissions issue with the OAuth token. It's possible that the trial area isn't authorized for the Mashery V3 API. Mashery Support should be able to assist you there. Do you see any other errors in the browser's developer tools (network tab)?

@saurabh12n
Copy link

Sorry but I think I am not getting your query about developer tool. What is this browser's developer tools (network tab)? How to use or check this?

@rkiesler1
Copy link
Contributor

Use Fn+F12 keyboard shortcut (Chrome/Firefox)
image

@saurabh12n
Copy link

Yes, I can see errors there ..

image

image

@rkiesler1
Copy link
Contributor

rkiesler1 commented Jul 27, 2021 via email

@saurabh12n
Copy link

No, there are no errors by selecting XHR.
image

@rkiesler1
Copy link
Contributor

rkiesler1 commented Jul 28, 2021 via email

@saurabh12n
Copy link

saurabh12n commented Jul 28, 2021

I manage to get a new Area . Now there is no trial account. I put information of second area in the credentials.js file and now start the Copy File. This time I am getting error [object:Object] .

When I check command prompt logs , it is showing 403 error as below :
C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter>node bin/www
(node:4444) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use node --trace-deprecation ... to show where the warning was created)
GET / 304 41.410 ms - -
GET /stylesheets/style.css 304 4.888 ms - -
GET /stylesheets/main.css 304 6.820 ms - -
GET /stylesheets/application.css 304 3.809 ms - -
GET /javascripts/jquery-1.12.0.min.js 304 9.162 ms - -
GET /copyapi 200 98.652 ms - 10705
GET /stylesheets/style.css 304 7.099 ms - -
GET /stylesheets/main.css 304 7.618 ms - -
GET /stylesheets/application.css 304 8.149 ms - -
GET /javascripts/jquery-1.12.0.min.js 304 2.180 ms - -
GET /javascripts/Markdown.Converter.js 304 2.396 ms - -
GET /javascripts/Markdown.Sanitizer.js 304 1.736 ms - -
POST /copyapi 200 3710.282 ms - 346886
GET /stylesheets/style.css 304 2.778 ms - -
GET /stylesheets/main.css 304 4.283 ms - -
GET /stylesheets/application.css 304 2.699 ms - -
GET /javascripts/jquery-1.12.0.min.js 304 3.640 ms - -
GET /javascripts/Markdown.Converter.js 304 1.676 ms - -
GET /javascripts/Markdown.Sanitizer.js 304 1.953 ms - -
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":4444,"level":30,"msg":"Created new service 'undefined' with ID 'undefined'","time":"2021-07-28T08:20:02.331Z","v":0}
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":4444,"level":20,"msg":"Registering new domain: 'undefined' is now undefined","time":"2021-07-28T08:20:03.253Z","v":0}
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":4444,"level":50,"msg":"{\n "errorCode": 403,\n "errorMessage": "Forbidden"\n}","time":"2021-07-28T08:20:03.255Z","v":0}
POST /copyapi 200 6579.391 ms - 10723
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":4444,"level":20,"msg":"Registering new domain: 'undefined' is now undefined","time":"2021-07-28T08:20:03.331Z","v":0}
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":4444,"level":20,"msg":"Registering new domain: 'undefined' is now undefined","time":"2021-07-28T08:20:03.339Z","v":0}
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":4444,"level":20,"msg":"Registering new domain: 'undefined' is now undefined","time":"2021-07-28T08:20:03.344Z","v":0}
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:561:11)
at ServerResponse.header (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\express\lib\response.js:718:10)
at ServerResponse.send (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\express\lib\response.js:163:12)
at done (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\express\lib\response.js:957:10)
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:93:9
at Object.done (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\async.js:74:20)
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:88:18
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:69:11
at Object.done (C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\async.js:74:20)
at C:\saurabh\SELFRIDGE\MashCli\MasheryTools\masherytools\api_definition_converter\node_modules\hbs\lib\hbs.js:64:20

@rkiesler1
Copy link
Contributor

rkiesler1 commented Jul 28, 2021 via email

@saurabh12n
Copy link

saurabh12n commented Jul 30, 2021

Hi,

Thanks for the recommendation. I am not used to with Swagger/OpenAPI and also this tool can fulfill my requirement, that is why I want to use this tool itself.

Now I create a API in trail account and used trial "eval469672.api.mashery.com" as public endpoint and "ap-southeast-2.integration.cloud.tibcoapps.com" as target endpoint and then I copy API from Trail account to my project Mashery Area and this time it is successful .

Now I create one dummy API in my Project Mashery Area with public "mycompany.api.mashery.com" endpoint and "ap-southeast-2.integration.cloud.tibcoapps.com" as target endpoint and then try to copy API from my project Mashery Area to my Trail account and this time it is failed with below error :

{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":14528,"level":30,"msg":"Created new service 'undefined' with ID 'undefined'","time":"2021-07-30T11:25:27.621Z","v":0}
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":14528,"level":50,"msg":"{\n "errorCode": 404,\n "errorMessage": "Not Found"\n}","time":"2021-07-30T11:25:28.740Z","v":0}
POST /copyapi 200 6105.948 ms - 10721
{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":14528,"level":20,"msg":"Registering new domain: 'undefined' is now undefined","time":"2021-07-30T11:25:28.836Z","v":0}

@rkiesler1
Copy link
Contributor

rkiesler1 commented Jul 30, 2021 via email

@saurabh12n
Copy link

saurabh12n commented Aug 17, 2021

Hi rkiesler1,

Now I am able to copy API from one area to other area. In one of my API, I am getting this error:

{"name":"copyapi","hostname":"DESKTOP-T0DAMUT","pid":19708,"level":50,"msg":"Unable to create service definition endpoint. Property 'customRequestAuthenticationAdapter' is required if requestAuthenticationType is custom.","time":"2021-08-17T13:26:16.449Z","v":0}

Can you please let me know what extra things we need to do in this case? Because we already have this property in our endpoint.

image

@rkiesler1
Copy link
Contributor

rkiesler1 commented Aug 17, 2021 via email

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

3 participants