-
Notifications
You must be signed in to change notification settings - Fork 184
Aws appsync websocket transport #239
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
Aws appsync websocket transport #239
Conversation
… lots of stuff and not writing tests in the process :shamecube:
picking this back up today. Going to start with:
|
A couple questions, as I read through this:
Note w.r.t. the above two questions, I've removed the wait_for_ack and the new receive_data_loop from the overloaded _send_query(). I can easily add them back, but I wanted to be as compatible with the base _send_query as possible and did not want to leak extra event loops nor duplicate wait events. Note also that, because we've overloaded the _send_query() method as suggested and because we're manipulating the URL once during init, we've left both the Next steps:
Will be pushing code shortly. |
…overload connect() and subscribe()
… started adding some dependency injection as well as some fakes.
Because with the aws protocol, an ack is sent by the backend but it is not the case with the apollo protocol
Indeed, only the one in the connect is necessary |
Very little time this weekend. Going to start on expanding the test coverage and trying to clean up the code checks. |
… passed to add_auth. Gotta find where they should be coming from...
Started working on getting existing appsync tests to pass. Found out that the Gotta stop here for the night, unfortunately. Didn't get very far. Will keep coming back to thins until I get it, though. |
Looking into how to get AWS credentials object into |
…ow, about request needing some additional structure. That's next.
Figured out it was because my profile was wrong. Need to add a test for NoCredentialsError() where I inform the user that they need to specify a profile or set their default profile in their ~/.aws/credentials file (not sure how this works in windows, but I assume it's similar) |
New error is about the fake request:
I'm guessing I need to set a timestamp on the request or find a better way of creating it that will set my timestamp for me. I had really hoped to avoid having to muck with dates. |
Adding the exception handling for the missing credentials and working on getting the last test to pass before adding more. |
…all pass. Added additional validation and error handling for various states of credentials. Added additional fakes as needed.
Added the exception handling for the missing credentials. Also added exception handling for missing region even if credentials are provided. Got all tests to pass as-is. Next will be adding the e2e tests that talk to AWS using my actual credentials, and then also tying it into the existing websocket server tests as well. Then I'll do a smoke test and clean up the docblocks and add documentation. |
Codecov Report
@@ Coverage Diff @@
## master #239 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 23 26 +3
Lines 1822 1997 +175
==========================================
+ Hits 1822 1997 +175
Continue to review full report at Codecov.
|
For the linting issues, you can run For the failing tests, you should add an aws element in the |
Starting. Goal:
|
I appear to have had some sort of system failure. |
Reformatted and installed latest fedora, back up and running. Not sure I'll be able to get much done tonight, unfortunately, but I should be able to add the "aws" line and fix the linting once I get pycharm and git set back up. |
Going to have to stop here. Let's see what happens with CI. I'll pick away a bit more throughout the week now that I'm back up and running. No idea what happened, but my filesystem randomly became "readonly" in the middle of playing with PyCharm and tweaking some battery-related stuff. |
Not sure why the tests still failed. Will look into that later. Looking into the existing websocket test and going to try to get it to validate my aws extension as well. Not sure if I'll need to copy/paste lots of it (I'd prefer not to). Need to better understand that websocket server thing you got in conftest.py |
Add keep_alive_timeout parameter Add error message if user is trying to use the transport with fetch_schema_from_transport=True
Note: I merged the two JWT classes into one as from our point of view it is the same thing. A̶l̶s̶o̶ ̶I̶ ̶h̶a̶v̶e̶ ̶s̶o̶m̶e̶t̶h̶i̶n̶g̶ ̶s̶t̶r̶a̶n̶g̶e̶,̶ ̶t̶h̶e̶ ̶t̶e̶s̶t̶ ̶ |
…te 'GRAPHQLWS_SUBPROTOCOL'
Modify AIOHTTPTransport to accept an AppSync auth class
For Reference my Next, I add the following error: This one was solved by creating the Now I can execute queries, mutations and subscriptions with IAM. |
The |
Rename test_appsync_subscription.py to tests/test_appsync_websockets.py
The markers are described in conftest.py and can be checked by running: pytest --markers
@joseph-wortmann @chadfurman could you please check that the PR is ok for you as it is now? Do you have remarks? |
I've been following your commits and have no reason to object to anything here. If there's functionality missing / needed / broken it will show during usage more than my review and so will lend itself to iteration. I think this is fine as is. Great work and thank you for taking it over. |
AWS AppSyncWebsocketTransport inspired by (and largely copied from) the work of @joseph-wortmann
For original discussion thread, go here: #125
At the time of creating this draft PR, these are the next steps:
Follow the discussion here below for further updates.