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

feat: api gateway management api on /_arc/ws #640

Merged
merged 5 commits into from Nov 11, 2021

Conversation

reconbot
Copy link
Member

@reconbot reconbot commented Aug 21, 2021

Works! I've tested this outside of our library.

TODO

references

Working code for arc functions (only sandbox tested)

const makeManagementAPI = () => {
  const ARC_WSS_URL = process.env.ARC_WSS_URL
  const port = process.env.ARC_INTERNAL || '3332'

  if (process.env.NODE_ENV === 'testing') {
    return new ApiGatewayManagementApi({
      apiVersion: '2018-11-29',
      endpoint: `http://localhost:${port}/_arc/ws`,
      region: process.env.AWS_REGION || 'us-west-2',
    })
  }
  return new ApiGatewayManagementApi({
    apiVersion: '2018-11-29',
    endpoint: `${ARC_WSS_URL.replace(/$ws/, 'http')}`,
  })
}

closes architect/architect#1204

Thank you for helping out! ✨

We really appreciate your commitment to improving Architect

To maintain a high standard of quality in our releases, before merging every pull request we ask that you've completed the following:

  • Forked the repo and created your branch from master
  • Made sure tests pass (run npm it from the repo root)
  • Expanded test coverage related to your changes:
    • Added and/or updated unit tests (if appropriate)
    • Added and/or updated integration tests (if appropriate)
  • Updated relevant documentation:
  • Summarized your changes in changelog.md
  • Linked to any related issues, PRs, etc. below that may relate to, consume, or necessitate these changes

Please also be sure to completed the CLA (if you haven't already).

Learn more about contributing to Architect here.

Thanks again!

reconbot added a commit to reconbot/graphql-lambda-subscriptions that referenced this pull request Aug 21, 2021
- fix error handling for validation and execution execution context errors to send an Error message
- change the onSubscribe Callback to send an Error message to allow denying a subscription without trashing the connection
- change the testing execution helper to have a stream of websocket events instead of using the graphql-ws client, this lets us more easily compare outputs between the servers
- port testing to a branch of the arc sandbox that fully supports the api gateway management api (architect/sandbox#640)
reconbot added a commit to reconbot/graphql-lambda-subscriptions that referenced this pull request Aug 21, 2021
- fix error handling for validation and execution execution context errors to send an Error message
- change the onSubscribe Callback to send an Error message to allow denying a subscription without trashing the connection
- change the testing execution helper to have a stream of websocket events instead of using the graphql-ws client, this lets us more easily compare outputs between the servers
- port testing to a branch of the arc sandbox that fully supports the api gateway management api (architect/sandbox#640)
reconbot added a commit to reconbot/graphql-lambda-subscriptions that referenced this pull request Aug 21, 2021
- fix error handling for validation and execution execution context errors to send an Error message
- change the onSubscribe Callback to send an Error message to allow denying a subscription without trashing the connection
- change the testing execution helper to have a stream of websocket events instead of using the graphql-ws client, this lets us more easily compare outputs between the servers
- port testing to a branch of the arc sandbox that fully supports the api gateway management api (architect/sandbox#640)
reconbot added a commit to reconbot/graphql-lambda-subscriptions that referenced this pull request Aug 21, 2021
- fix error handling for validation and execution execution context errors to send an Error message
- change the onSubscribe Callback to send an Error message to allow denying a subscription without trashing the connection
- change the testing execution helper to have a stream of websocket events instead of using the graphql-ws client, this lets us more easily compare outputs between the servers
- port testing to a branch of the arc sandbox that fully supports the api gateway management api (architect/sandbox#640)

BREAKING CHANGE: onSubscribe now sends error messages instead of disconnecting
@reconbot reconbot force-pushed the reconbot/management-api branch 5 times, most recently from 7adf88d to 89fffae Compare August 24, 2021 14:53
@reconbot reconbot marked this pull request as ready for review August 24, 2021 15:31
src/arc/_ws/index.js Show resolved Hide resolved
src/arc/_listener.js Show resolved Hide resolved
if (req.method === 'GET') {
const output = {
ConnectedAt: new Date(pool.getConnectedAt(connectionId)).toISOString(),
// LastActiveAt: 'I wish this was easy to figure out but it is optional',
Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't find anything in ws that lets us know this.

@reconbot reconbot force-pushed the reconbot/management-api branch 2 times, most recently from 94c1976 to 05cf0e8 Compare September 7, 2021 18:50
@reconbot
Copy link
Member Author

reconbot commented Sep 7, 2021

rebased

@reconbot
Copy link
Member Author

reconbot commented Oct 4, 2021

rebased again 🤞

reconbot and others added 4 commits November 3, 2021 22:47
- Fix tests that didn't expect a new path
- Add api gateway websocket management to the management server
@reconbot reconbot force-pushed the reconbot/management-api branch 4 times, most recently from a3bad09 to 1a59838 Compare November 11, 2021 03:50
@ryanblock ryanblock changed the base branch from main to management-api November 11, 2021 17:05
@ryanblock ryanblock merged commit 5ed093f into architect:management-api Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants