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

Feature/no proxy selected #1459

Merged
merged 65 commits into from
Sep 9, 2016
Merged

Feature/no proxy selected #1459

merged 65 commits into from
Sep 9, 2016

Conversation

frenchbread
Copy link
Contributor

@frenchbread frenchbread commented Aug 30, 2016

Closes #1382 #1394

@frenchbread
Copy link
Contributor Author

Depends on #1457

@55 55 self-assigned this Aug 30, 2016
// Try to create user on API Umbrella
try {
// Add user on API Umbrella
const response = apiUmbrellaWeb.adminApi.v1.apiUsers.createUser(apiUmbrellaUserObj);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiUmbrellaWeb is no longer a global object. Instead, we now have a createApiUmbrellaWeb factory method, which outputs an ApiUmbrellaWeb instance. Use the factory to create an ApiUmbrellaWeb instance prior to using it here.

@brylie
Copy link
Contributor

brylie commented Sep 8, 2016

ApiUmbrellaWeb

This code shows progress. However, there are significant changes needed to the approach, in light of recent changes to our apiUmbrellaWeb instance.

apiUmbrellaWeb is no longer a global object. Instead, we now have a createApiUmbrellaWeb factory method, which outputs an ApiUmbrellaWeb instance. Within each Meteor method where apiUmbrellaWeb is used, we now have to call the factory method to get an ApiUmbrellaWeb object in the function scope.

File/folder structure

There are also a few structural comments:

  • use underscores in file/directory names instead of camelCase
  • move proxy related Meteor methods, helper functions, etc. into relevant subfolders within the proxies module
    • API Umbrella methods go in /proxies/server/methods/api_umbrella.js
    • API Umbrella helper functions go in /proxies/helper_functions/api_umbrella.js

Ville Jyrkkä and others added 13 commits September 8, 2016 13:03
# Conflicts:
#	core/client/layouts/master_layout/navbar/navbar.js
#	home/client/header/homeHeader.html
#	home/client/header/homeHeader.js
… into feature/no-proxy-selected

# Conflicts:
#	core/client/layouts/master_layout/navbar/navbar.js
#	home/client/header/homeHeader.html
#	home/client/header/homeHeader.js
@frenchbread
Copy link
Contributor Author

Suggested changes are done.

When testing consider running meteor reset to check Apis fetch from APi Umbrella after adding new proxy.

❓ Why do we hardcode api_umbrella prefix here? @brylie @jykae

@55
Copy link
Contributor

55 commented Sep 9, 2016

Getting this when trying to delete API:

Exception in delivering result of invoking 'deleteApiBackendOnApiUmbrella': TypeError: Cannot read property 'http_status' of undefined
    at http://localhost:3000/app/app.js?hash=daca40d98d454f1c963417b3a42c281cf85cdcee:2143:35
    at MethodInvoker._callback (http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:1105:22)
    at MethodInvoker._maybeInvokeCallback (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3557:12)
    at MethodInvoker.receiveResult (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3577:10)
    at Connection._livedata_result (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:4736:9)
    at onMessage (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3385:12)
    at http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:2736:11
    at Array.forEach (native)
    at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=27b3d669b418de8577518760446467e6ff429b1e:149:11)
    at REventTarget.self.socket.onmessage (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:2735:11)

@brylie
Copy link
Contributor

brylie commented Sep 9, 2016

That error may have been resolved by PR #1517

@brylie
Copy link
Contributor

brylie commented Sep 9, 2016

We hard code the API Umbrella base prefix to make configuration simpler. I.e. we want our settings page only to contain the API Umbrella host/protocol, and not the Admin API path.

What alternative do you propose?

@brylie
Copy link
Contributor

brylie commented Sep 9, 2016

E.g. we might save the /api-umbrella/ string as a base_path field in the Proxies.apiUmbrella schema.

@55
Copy link
Contributor

55 commented Sep 9, 2016

@brylie, yes, resolved, but getting this right after API is removed:

Exception in delivering result of invoking 'getApiStatus': TypeError: Cannot read property 'code' of undefined
    at http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:765:30
    at MethodInvoker._callback (http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:1105:22)
    at MethodInvoker._maybeInvokeCallback (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3557:12)
    at MethodInvoker.receiveResult (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3577:10)
    at Connection._livedata_result (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:4736:9)
    at onMessage (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3385:12)
    at http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:2736:11
    at Array.forEach (native)
    at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=27b3d669b418de8577518760446467e6ff429b1e:149:11)
    at REventTarget.self.socket.onmessage (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:2735:11)
debug.js:41 Exception in template helper: TypeError: Cannot read property '_id' of undefined
    at Object.currentUserCanEditBacklog (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:31735:27)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:66
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:27
    at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:18)
    at Template.apiBacklog.HTML.DIV.HTML.DIV.Blaze.If.HTML.BUTTON.id (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:31688:22)
    at .<anonymous> (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2677:44)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:20
debug.js:41 Exception from Tracker recompute function:
debug.js:41 TypeError: Cannot read property 'documentationFileId' of undefined
    at .<anonymous> (documentation.js:10)
    at view.js:199
    at Function.Template._withTemplateInstanceFunc (template.js:465)
    at view.js:197
    at Object.Blaze._withCurrentView (view.js:538)
    at viewAutorun (view.js:196)
    at Tracker.Computation._compute (tracker.js:311)
    at Tracker.Computation._recompute (tracker.js:330)
    at Object.Tracker._runFlush (tracker.js:495)
    at onGlobalMessage (setimmediate.js:102)
debug.js:41 Exception in template helper: TypeError: Cannot read property 'documentation_link' of undefined
    at Object.documentationLink (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:30192:39)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:66
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:27
    at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:18)
    at Template.documentation.HTML.DIV.HTML.DIV.HTML.DIV.HTML.DIV.Blaze.If.HTML.DIV.class (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:30058:22)
    at .<anonymous> (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2677:44)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:20
debug.js:41 Exception in template helper: TypeError: Cannot read property 'documentationFileId' of undefined
    at Object.codegenServerExists (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:30217:38)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:66
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:27
    at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:18)
    at Blaze.If.HTML.BUTTON.id (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:30028:24)
    at .<anonymous> (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2677:44)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:20
debug.js:41 Exception in template helper: TypeError: Cannot read property 'documentationFileId' of undefined
    at Object.documentationExists (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:30204:14)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:66
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:27
    at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:18)
    at http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:30111:24
    at .<anonymous> (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2677:44)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:20
debug.js:41 Exception in template helper: TypeError: Cannot read property '_id' of undefined
    at Object.metadata (http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:34482:36)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:16
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:66
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:27
    at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:18)
    at http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:34321:22
    at .<anonymous> (http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2677:44)
    at http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:20
19debug.js:41 Exception in delivering result of invoking 'getApiStatus': TypeError: Cannot read property 'code' of undefined
    at http://localhost:3000/app/app.js?hash=032772da68bbcc8fb8cc6456d7262c28a13eee90:765:30
    at MethodInvoker._callback (http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:1105:22)
    at MethodInvoker._maybeInvokeCallback (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3557:12)
    at MethodInvoker.receiveResult (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3577:10)
    at Connection._livedata_result (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:4736:9)
    at onMessage (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:3385:12)
    at http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:2736:11
    at Array.forEach (native)
    at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=27b3d669b418de8577518760446467e6ff429b1e:149:11)
    at REventTarget.self.socket.onmessage (http://localhost:3000/packages/ddp-client.js?hash=27502404fad7fc072e57e8b0b6719f40d92709c7:2735:11)

@55
Copy link
Contributor

55 commented Sep 9, 2016

I wonder if we need to create a separate issue for this or to resolve it here?

@brylie
Copy link
Contributor

brylie commented Sep 9, 2016

@NNN yes, create a separate issue. It is related to template helpers trying to access properties of the API that has been deleted. There is a moment where the API is deleted, but the API template is still rendered.

@brylie
Copy link
Contributor

brylie commented Sep 9, 2016

Will you be merging this PR @NNN?

@55 55 merged commit 56b538e into develop Sep 9, 2016
@55 55 deleted the feature/no-proxy-selected branch September 9, 2016 06:56
@frenchbread
Copy link
Contributor Author

frenchbread commented Sep 9, 2016

We hard code the API Umbrella base prefix to make configuration simpler. I.e. we want our settings page only to contain the API Umbrella host/protocol, and not the Admin API path.
What alternative do you propose?

@brylie I'd suggest using Proxy Base URL as a complete url for Api Umbrella - not hardcoding part if it. For example if someone creates API Umbrella instance on separate domain and routes it serve requests without api-umbrella prefix. In this case syncing mechanism will break.

@brylie
Copy link
Contributor

brylie commented Sep 9, 2016

One problem is that we would have to strip the /api-umbrella/ from the base url setting when displaying instructions for API usage. In effect, this would be the inverse of hard coding, since we would be stripping out a string as opposed to appending one.

In a nutshell:

  • proxyBaseUrl + /api-umbrella/ is necessary for Admin API calls (via ApiUmbrellaWeb)
  • proxyBaseUrl+ /<proxy_base_path>/ is used for Proxy API calls (from API consumers)

@ilarimikkonen ilarimikkonen added this to In Review in apinf/platform Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants