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

AWSHttpRequest body not showing in Dart's dev tools #4847

Closed
1 of 14 tasks
livioschlaepfer opened this issue May 7, 2024 · 6 comments
Closed
1 of 14 tasks

AWSHttpRequest body not showing in Dart's dev tools #4847

livioschlaepfer opened this issue May 7, 2024 · 6 comments
Assignees
Labels
pending-community-response Pending response from the issue opener or other community members question A question about the Amplify Flutter libraries

Comments

@livioschlaepfer
Copy link

livioschlaepfer commented May 7, 2024

Description

Using AWSHttpRequest from package aws_common fails to create a request body on web.
See attached screenshots of created request mobile vs web.

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. Create an AWSHttpRequest
 final request = AWSHttpRequest.post(
       Uri.parse('<your-url>'),
       headers: const {
         AWSHeaders.contentType: 'application/json',
       },
       body: json.encode({
         'first_name': 'max',
         'last_name': 'muster',
       }).codeUnits,
     );
  1. Compare created request on mobile and web

Screenshots

Generated request object on web:
image

Generated request object on mobile:
image

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.16.8

Amplify Flutter Version

aws_common: 0.6.3

Deployment Method

Amplify CLI

Schema

No response

@khatruong2009 khatruong2009 added the pending-triage This issue is in the backlog of issues to triage label May 7, 2024
@khatruong2009
Copy link
Member

Hi @livioschlaepfer, we will take a look at this issue and get back to you when we have an update.

@khatruong2009 khatruong2009 self-assigned this May 9, 2024
@khatruong2009 khatruong2009 added bug Something is not working; the issue has reproducible steps and has been reproduced and removed pending-triage This issue is in the backlog of issues to triage labels May 9, 2024
@livioschlaepfer
Copy link
Author

@khatruong2009 are there any updates on this?

@Jordan-Nelson
Copy link
Member

@livioschlaepfer I am not able to reproduce the exact issue you are facing. I see there is a body on both web and mobile. The body doesn't seem to display correctly in Dart's dev tools when running on web (see screenshot below).

Screenshot 2024-06-11 at 5 07 47 PM

However, the body is present. I can listen to it an receive data (see code snippet below). I also see the body in Chrome's dev tools when I make the request. I am unsure why it is not displaying correctly in Dart's dev tools. This maybe be an issue with Dart's dev tools.

Is the issue you are facing consistent with what I have described?

Here is the code snippet I was using:

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(),
        body: Center(
          child: Column(
            children: [
              FilledButton(
                onPressed: () {
                  final request = AWSHttpRequest.post(
                    Uri.parse('https://jsonplaceholder.typicode.com/posts'),
                    headers: const {
                      AWSHeaders.contentType: 'application/json; charset=UTF-8',
                    },
                    body: jsonEncode({
                      'title': 'foo',
                      'body': 'bar',
                      'userId': 1,
                    }).codeUnits,
                  );
                  request.body.listen((data) => safePrint('got data: $data'));
                  safePrint('body: ${request.body}');
                  request.send();
                },
                child: const Text('request'),
              ),
            ],
          ),
        ),
      ),
    );
  }

@Jordan-Nelson Jordan-Nelson changed the title AWSHttpRequest body creation fails on web AWSHttpRequest body no showing in Dart's dev tools Jun 11, 2024
@Jordan-Nelson Jordan-Nelson added the pending-community-response Pending response from the issue opener or other community members label Jun 11, 2024
@Jordan-Nelson
Copy link
Member

@livioschlaepfer if you are not seeing the value at all it is likely because you have the following dart settings disabled: Show Getters In Debug Views. You can follow this comment to enable/disable it.

@Jordan-Nelson Jordan-Nelson changed the title AWSHttpRequest body no showing in Dart's dev tools AWSHttpRequest body not showing in Dart's dev tools Jun 11, 2024
@Jordan-Nelson
Copy link
Member

I created a minimal reproduction of this and opened an issue here. This seems like a dart issue to me but maybe it is intentional that this is not supported. Either way I don't think it is a bug in amplify_common. I am going to update this to a question for now.

@Jordan-Nelson Jordan-Nelson added question A question about the Amplify Flutter libraries and removed bug Something is not working; the issue has reproducible steps and has been reproduced labels Jun 11, 2024
@Jordan-Nelson
Copy link
Member

@livioschlaepfer - I am going to close this out now that there is an issue open with dart. It looks like they need to investigate if this can be supported on web. I don't think there is much we can do in amplify flutter.

@Jordan-Nelson Jordan-Nelson closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-community-response Pending response from the issue opener or other community members question A question about the Amplify Flutter libraries
Projects
None yet
Development

No branches or pull requests

3 participants