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
browser sdk in angular is unable to parse responses from amazon services #240
Comments
P.S. I also attempted installing the Buffer package and the peer it said it needed |
Hi @bibyzan, as we discussed in the community slack, we have opened up a ticket for this bug and have begun looking into this dependency problem that seems specific to angular. |
We have identified the problem and worked with the js-bson team to come up with a solution. We will be sure to let you know when we can release this change. |
Hey @tkaye407 thanks for the response. Glad to hear progress is being made. I just wanted to highlight the escalation of my request for a fix here, because it seems to extend to any Amazon service I try to use. Resulting in my inability to really utilize this sdk for anything besides auth, mongo access, and calling pre-parsed stitch functions. I just recently setup an AWS Lambda function with the node package I needed to run which works when I call it from a regular rest client. However, when I attempt to invoke the function (with the Stitch js browser SDK) similarly to s3.PutObject in this case, I get back a ZoneAwarePromise containing the unhandled Buffer error. Another side note, I'm not 100% sure if I'm doing this right since this doesn't seem to be covered in the Stitch documentation. I inferred how I was supposed to do this by looking at this doc by amazon https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html Here's how I create and call everything with the error output: this.aws = this.stitch.client.getServiceClient(AwsServiceClient.factory, 'my_aws_service');
const request = new AwsRequest.Builder()
.withService('lambda')
.withAction('Invoke')
.withArgs({
FunctionName: 'my-serverless-lambda-function-name'
}).withRegion('us-east-1')
.build();
const response = this.aws.execute(request);
console.log('response!', response); Output:
|
UPDATE: I did just find this link that has a lambda function call from a stitch function. I'll pursue this workaround for now which I know will only work if I modify the response from amazon before sending it to the client (because sending that response to be parsed is what breaks) |
Hey @bibyzan, I apologize for the delay but we just released version 4.3.2 of the JS SDK and this should fix your problem. This seems to have been an Angular-specific bug where were relied on something that angular took out. However, currently in order to use the Stitch SDK in Angular you have to add the following line to your polyfills.ts file: I just tested this personally on a brand new angular project and it works perfectly, but let me know if you run into any more issues. |
Hi @bibyzan, I assume that this worked for you so I will be closing this issue. Please let us know if you have any more issues or questions. Happy Stitching, |
Hey @tkaye407 Thanks for the updates, I finally had a chance to try your fix and it looks like it works now! Thanks, Bennett |
When I call s3.GetObject I can get this error from 2 scenarios
From a Stitch function:
Called from the sdk:
When called in the stitch UI console, this comes back successful, but when the function is called via the browser sdk (with the full result promise returned in the function) I get the above error.
As already discussed in slack, changing result to result.Body.text() will let the success through, but being my OCD self I wanted to find the alternative that is functioning correctly so I don't leave a mistake somewhere and forget.
The next option was to call my s3 service directly from the stitch browser sdk so I run this:
But still the same error! Any ideas?
Also dependencies:
Thanks
The text was updated successfully, but these errors were encountered: