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

Unable to enable FCM channel #13998

Closed
2 tasks done
Cosmooooo opened this issue Oct 28, 2024 · 6 comments
Closed
2 tasks done

Unable to enable FCM channel #13998

Cosmooooo opened this issue Oct 28, 2024 · 6 comments
Labels
notifications Issues tied to the notifications category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage

Comments

@Cosmooooo
Copy link

How did you install the Amplify CLI?

npm install

If applicable, what version of Node.js are you using?

v18.17.1

Amplify CLI Version

12.12.0

What operating system are you using?

mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

no

Describe the bug

amplify update notification
✔ Choose the notification channel to configure · FCM | » Firebase Push Notifications
✔ Do you want to enable the FCM channel (Y/n) · yes
✔ Server Key · ./********************.json
🛑 Failed to enable the FCM channel

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: c1442391-7195-43ca-ba2d-4976d9a3ab8d

Expected behavior

enable FCM channel

Reproduction steps

  1. we have apns set up and working properly
  2. set up firebase project and download the private key from Firebase Admin SDK
  3. amplify update notification and provide private key

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@Cosmooooo Cosmooooo added the pending-triage Issue is pending triage label Oct 28, 2024
@ykethan
Copy link
Member

ykethan commented Oct 29, 2024

Hey @Cosmooooo, could you try adding --debug to amplify update notification and provide us the output?

@ykethan ykethan added notifications Issues tied to the notifications category pending-response Issue is pending response from the issue author labels Oct 29, 2024
@Cosmooooo
Copy link
Author

amplify update notification --debug
✔ Choose the notification channel to configure · FCM  | » Firebase Push Notifications 
✔ Do you want to enable the FCM channel (Y/n) · yes
✔ Server Key · ./*********-********-*******.json
🛑 Failed to enable the FCM channel

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

NotificationsChannelFCMFault: Failed to enable the FCM channel
    at enable (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/channel-fcm.js:68:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.configure (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/channel-fcm.js:32:13)
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/commands/notifications/configure.js:61:40)
    at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/index.js:62:5)
    at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
    at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)

FCM returned 401 Unauthorized
BadRequestException: FCM returned 401 Unauthorized
    at Object.extractError (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/protocol/json.js:80:27)
    at Request.extractError (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/protocol/rest_json.js:61:8)
    at Request.callListeners (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /snapshot/amplify-cli/build/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
    at Request.emit (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /snapshot/amplify-cli/build/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
    at callNextListener (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
    at IncomingMessage.onEnd (/snapshot/amplify-cli/build/node_modules/aws-sdk/lib/event_listeners.js:417:13)
    at IncomingMessage.emit (node:events:525:35)
    at IncomingMessage.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Session Identifier: b5863f9c-4aa4-4d20-ab44-a353f4f181ce

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 29, 2024
@ykethan
Copy link
Member

ykethan commented Oct 29, 2024

Hey @Cosmooooo, thank you for the information. From the stack trace it appears the cause of the error is due to FCM returned 401 Unauthorized when the pinpoint client is trying to update the channels.

const data = await context.exeInfo.pinpointClient.updateGcmChannel(params).promise();

Could you re-verify if the key being provided is currently valid? as i was unable to reproduce the issue by creating a new key using the following document and updating FCM with the json file
https://cloud.google.com/iam/docs/keys-create-delete#iam-service-account-keys-create-console

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Oct 29, 2024
@ykethan
Copy link
Member

ykethan commented Nov 12, 2024

@Cosmooooo following up on this, were you able to deploy the notifications channel?

@ykethan
Copy link
Member

ykethan commented Nov 19, 2024

Closing the issue due to inactivity. Do reach out to us if you are still experiencing this issue

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2024
Copy link

This issue is now closed. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notifications Issues tied to the notifications category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants