Closed mdoesburg closed 1 year ago
The Amplify docs suggest that you need to setup the Analytics category before adding the Notifications category:
Push Notifications category is integrated with AWS Amplify Analytics category to be able to track notifications. Make sure that you have configured the Analytics category in your app before configuring the Push Notifications category.
This Medium post suggest you shouldn't:
Note: Do NOT also run amplify add analytics because amplify add notifications already initializes an AWS Pinpoint project, called AmplifyAndroidPushXXXXX-env
I did run amplify analytics add
prior to running amplify notifications add
in my initial environment, and ended up with only one Pinpoint project, which is shared by the Analytics category and Notifications category, but in my new env I end up with 2 Pinpoint projects.
Could this be related or the cause of this issue?
I know running amplify analytics add
prior to amplify notifications add
is a requirement, since you cannot add permissions to a function with just the notifications category. Attempting to add notifications permissions to a Lambda function results in the following message:
Policies cannot be added for notifications/resource-name
The only way for a Lambda function to send push notifications is to add permissions for the analytics category, but with that being said, I feel like the core issue lies with adding these 2 categories, since a new environment doesn't seem to understand these should share the same Pinpoint project?
For anyone else facing this issue, the workaround for now is:
After basically removing and re-adding the Analytics and Notifications categories, your new environment will only end up with one shared Pinpoint project.
Any decent solution yet?
I've spent most of the day debugging this issue.
Adding of notifications needs to happen first, When you then add analytics, the pinpoint provider detects that notifications exist and it writes the appId to the parameters.json The cloudformation doesn't create a new pinpoint instance if an appId is passed.
The problem though is that this will then fail when creating a new environment or switching between envronments.
When creating a new environment the first thing it does before the push is setup notifications and therefore creates a pinpoint instance.
If you then perform the push, because the AppId is saved in parameters.json it doesn't create a duplicate but now the aws-exports will reference an instance from a different stage that doesn't exist.
Perhaps doing something similar to functions where environment variables are injected into the parameters could be a fix?
Current workaround when adding a new environment
Seems to be still a problem.
Separate pinpoint created for notifications / analytics.
Deleted one thinking it wasn't in use, now we got a whole bunch of problems 😅
It just happened to us using amplify cli version 7.6.23.
Still happening to us as well, except when using the recommended fix to hardcode the appId in the parameters amplify ends up deleting the original Pinpoint Application. The only way for Amplify to create a new Pinpoint application is to remove the appId and have it blank.
asked for the .p12 again and again... some error here.
Since the previous workaround no longer seems to work, this may help some of you facing this issue. This is what worked for me as of version 9.1.0 of the CLI.
1. amplify env add <YOUR_ENV>
- Follow the prompts to setup notifications
3. amplify remove notifications
- Choose what to remove. The Pinpoint application
- Confirm that you want to delete the associated Amazon Pinpoint application Yes
4. amplify status
- Notifications should no longer be showing, while Auth and Analytics should be in Create
5. amplify push
- Are you sure you want to continue? Yes
6. amplify add notifications
- Follow prompts to setup notifications again
At the end of this I only had one pinpoint project that was setup as I expected it to be. Hope it helps
This is still a problem, even on the latest Amplify CLI.
Makes CI/CD with fresh backend environments really frustrating when anything that depends on Pinpoint starts failing.
For me, this breaks anything that touches Pinpoint, (Push,SMS, Analytics etc)
I believe I just ran into this as well. I'm not sure why since I've had a dev and test environment for months and the CI/CD has been working great. But what I didn't realize is that notifications weren't working on the test side (testers glossed over it). I now need to add the project ID in my code to send notifications in the test environment but of course I have two (actually three for some reason all with the same creation date back in March of this year).
Regardless of getting notifications working on our TEST environment I ran into the CI/CD issue where it hangs and then eventually times out after 30 minutes. In the amplify build logs it gets stuck at :
2022-10-06T17:36:49.610Z [WARNING]: - Building resource auth/[REDACTED]
Not much to go on but between this ticket and https://github.com/aws-amplify/amplify-hosting/issues/2541 listed above I'm drilling down into this pinpoint issue. I'll try the solution @bgneu has suggested on our test environment and see what happens.
We are facing the same issue as @Etep15, where our production environment won't deploy with amplify hosting when building react frontend.
It gets stuck on this
2022-10-20T01:37:57.831Z [WARNING]: - Building resource auth/userPoolGroups
After 30 minutes the build times out.
We were able to push the production environment backend with amplify push
from local computer, but now we can't deploy the frontend.
We also tried to skip the push within amplify hosting following the documentation here https://docs.aws.amazon.com/amplify/latest/userguide/amplify-config-autogeneration.html
However it still gets stuck:
2022-10-20T02:29:57.710Z [INFO]: ## Running amplify pull to generate aws-exports.js file for frontend
2022-10-20T02:30:01.399Z [INFO]: [0mAmplify AppID found: d3tyae2uog3myc. Amplify App name is: XXXXXXXXX[0m
2022-10-20T02:30:01.464Z [INFO]: [0mBackend environment prod found in Amplify Console app: Swysh Backoffice[0m
2022-10-20T02:30:06.000Z [WARNING]: - Fetching updates to backend environment: prod from the cloud.
2022-10-20T02:30:09.397Z [WARNING]: - Building resource auth/userPoolGroups
Hi @mdoesburg the issue with duplicate pinpoint projects should be fixed in latest Amplify CLI
Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug I have a project which uses push notifications. Upon creating a new environment by following the steps outlined here, the Amplify CLI prompts the user for APNS and FCM credentials prior to pushing. After supplying the credentials, the Pinpoint project gets created on AWS. This all happens before pushing the project to the cloud. After successfully going through all the
amplify env add
steps, and finishing withamplify push
, the Amplify CLI creates another Pinpoint project, resulting in 2 Pinpoint projects.I compared the
amplify-meta.json
files from my initial env (dev) and my new env (test), and noticed that the new (test) environment has a differentoutput.Id
underanalytics
than theoutput.Id
undernotifications
. The initial env has the same output IDs for these categories.This is problematic, because I have 2 Lambda functions which send out push notifications. They both have all the permissions for the 'analytics' category. Whenever one of these functions attempts to send a push notification in the test env, it fails because the function has the wrong Pinpoint ID.
Amplify CLI Version @aws-amplify/cli@4.27.1
To Reproduce
Expected behavior I expect only one Pinpoint project to be created, and my new enviroment to match my original environment.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):