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

NoSuchMethodError: The getter 'keys' was called on null. #3590

Closed
3 of 14 tasks
JoakimMellonn opened this issue Aug 21, 2023 · 4 comments
Closed
3 of 14 tasks

NoSuchMethodError: The getter 'keys' was called on null. #3590

JoakimMellonn opened this issue Aug 21, 2023 · 4 comments
Assignees
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced pending-release Issues that have been addressed in main but have not been released push notifications

Comments

@JoakimMellonn
Copy link

Description

I'm getting the above error while identifying a user with Push Notifications. The user is still identified in Pinpoint, so this doesn't actually create any problems for me, but it's still showing up every time. I have tested it both on Android and iOS, both on physical devices.

Here is the full error log:

I/flutter (13970): An error occurred while requesting notification permissions: NoSuchMethodError: The getter 'keys' was called on null.
I/flutter (13970): Receiver: null
I/flutter (13970): Tried calling: keys

Here is how I'm identifying the user:

final user = await Amplify.Auth.getCurrentUser();
final userProfile = AWSPinpointUserProfile(
  name: context.read<AuthAppProvider>().fullName,
  email: context.read<AuthAppProvider>().email,
);

await Amplify.Notifications.Push.identifyUser(
  userId: user.userId,
  userProfile: userProfile,
);

Categories

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

Steps to Reproduce

  1. Create Flutter app with Push notifications enabled.
  2. Identify user, the same way as shown in the docs.

Screenshots

No response

Platforms

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

Flutter Version

3.10.6

Amplify Flutter Version

1.3.3

Deployment Method

Amplify CLI

Schema

No response

@Equartey Equartey added pending-triage This issue is in the backlog of issues to triage push notifications labels Aug 21, 2023
@jamilsaadeh97
Copy link

@JoakimMellonn I had the same issue and I realized that the AWSPinpointUserProfile should have the userAttributes passed in the parameters (in my case I passed an empty map).

@JoakimMellonn
Copy link
Author

@JoakimMellonn I had the same issue and I realized that the AWSPinpointUserProfile should have the userAttributes passed in the parameters (in my case I passed an empty map).

That did also work for me, but it's still a kinda weird error message.

@Equartey Equartey self-assigned this Aug 23, 2023
@Equartey Equartey added bug Something is not working; the issue has reproducible steps and has been reproduced pending-release Issues that have been addressed in main but have not been released and removed pending-triage This issue is in the backlog of issues to triage labels Aug 23, 2023
@Equartey
Copy link
Contributor

@JoakimMellonn sorry you ran into this error.

This is a bug and I have opened a PR to address it.

In the mean time, y'all have identified the work around -- pass a value for userAttributes even if its an empty map {}. Alternatively, consider using the type UserProfile in place of AWSPinpointUserProfile where applicable.

@Equartey
Copy link
Contributor

Hey @JoakimMellonn, a fix for this was included in our latest release 1.4.0. Thanks again for identifying it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced pending-release Issues that have been addressed in main but have not been released push notifications
Projects
None yet
Development

No branches or pull requests

3 participants