-
Notifications
You must be signed in to change notification settings - Fork 594
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
refactor: Support all the webs #1123
Conversation
cb7e413
to
41634df
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
41634df
to
d455ef9
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Crap. I forgot to update stream-collector-web/CHANGELOG after the git mv from stream-collector-native. Will wait for feedback to open questions in PR description before buttoning up. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
0e6f077
to
d638485
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new name stream-collector-web
sounds good to me. Will need @trivikr for another look. We also need to confirm whether removing bufferBody
config from fetch-http-handler
will affect Amplify(I don't think so).
// TODO can we get rid of this? is there a scenario where a client wants to | ||
// insist on a Blob, even if stream is implemented? regardless, comment above | ||
// is outdated, this is not only useful in ReactNative due to variety of fetch | ||
// implementations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the same way. If we rely on dynamicly detecting the ReadableStream
implementation in the environment, we should remove it.
Hey @russell-dot-js Very awesome PR! Regarding your questions:
Given we prefer to return body in
Unfortunately we cannot do it. For any service/operations supporting streaming payload, we don't call StreamCollectors to the response, instead we return the stream from low-level http handler to users directly. In these case, the http handlers doesn't have the prior knowledge of whether the response is from an operation with streaming member. Generally very solid PR. I'd like to get some more set of eyes the review the solution. Ones we decide to go with this solution, I can provide some help with the code generation. Basically, we don't work directly on |
Thank you!! Happy to help.
Noted
Curious -- are you sure we can't do this? Example:
For the S3 client, the streamCollector would be ignored, but for most clients, it would be used.
Got it! I knew there was some code gen for the clients, but assumed that since the clients were checked in, they were not code-genned. For my own understanding, can you please clarify why the generated code is checked in? Is this to speed up CI, to keep every change in version control to ease human debugging, or to facilitate one-off edits of generated code (seems risky)? Also, I am curious why I have tests failing in CI that did not pass locally. |
d638485
to
ba7274e
Compare
@AllanFly120 I've amended my commit (do you prefer squashed PR's?) removing "bufferBody", and fixing the failing tests. I had to update the tests to not return "body", as the tests were returning strings, not ReadableStreams, and we do not have a ReadableStream polyfill set up for the node test environment (do we want one? It would be nice to add some unit tests demonstrating that it properly handles ReadableStream if implemented, and falls back to blob.) See changes in Also, regarding my question about yarn test:all -- it looks like test:all does not actually run all tests, it is defined as Were those scopes accidentally committed, or is the intent of test:all to only test those two packages? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@AllanFly120 / @trivikr just wanted to check in on this? Per #1121 (comment), @Stereobit also has users in a tough spot right now. Maybe we can at least release the quick fix in #1121 while this is reviewed? |
@russell-dot-js Hi, sorry for the late response. Can you remove all the diffs in |
// can we just check for existence of response.body, as that should be | ||
// guaranteed to be a ReadableStream if it exists? | ||
const hasResponseStream = typeof ReadableStream === 'function' && | ||
response.body instanceof ReadableStream; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point. I agree that we can just check response.body
for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and done
Was hoping you could response to my questions here:
#1123 (comment)
and here?
#1123 (comment)
ba7274e
to
0eedacd
Compare
* Collapse stream-collector-browser and stream-collector-native into stream-collector-web * Update FetchHttpHandler to return blob if stream not implemented
0eedacd
to
0bc10e8
Compare
Codecov Report
@@ Coverage Diff @@
## master #1123 +/- ##
==========================================
- Coverage 73.54% 73.53% -0.01%
==========================================
Files 283 284 +1
Lines 13014 13023 +9
Branches 3030 3035 +5
==========================================
+ Hits 9571 9577 +6
- Misses 3443 3446 +3
Continue to review full report at Codecov.
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
86dd467
to
fb381d9
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
After putting more thoughts on it I think: ✅ we can colapse Request handler are supposed to be a thin layer over the runtime primitives, it must return the raw low level response payload. It serves as the core of service client's middleware stack regardless of the service model. However, stream collector is a util function, although very commonly used, that defined by the service model. It is generated when the service needs structured response. Why is this difference important? Because V3 SDK is designed with a lot of flexibility. Any AWS client is extended from a white-labeled client that only knows the low-level request handler( I hope my explanation makes sense to you. |
We used string body because we simply run the test in Node runtime. It will be awesome if we ca have a webstream polyfill test. I think you can add the test in a separate PR if you want because many Amplify users are still blocked by this issue in SDK. I'd like get this fix merged in earlier
The scoped test script only runs in the 2 packages. Because the unit test in the packages are run in puppeteer, so we call the test script in the 2 packages explicitly. |
@russell-dot-js |
* Use web universal fetch handler and stream collector Correspond to aws/aws-sdk-js-v3#1123 * move runtime-specific stream collectors to individual request handler package
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Issue #, if available:
#1107
Description of changes:
The real changes are here and (starting) here. Rest is find-replace.
Open questions
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.