amplify-cli: Amplify Pull Notification: MAC verified OK But 🛑 Failed to enable the APNS channel.

Amplify CLI Version

12.10.0

Question

Hi, exactly like the closed one Issue #11916, I tried to pull an existing env, which we have been developing for ios in mac, in windows now for developing Android, I got the same error with Notification:

√ The certificate password (if any):  ·
MAC verified OK
× There was an error initializing your environment.
🛑 Failed to enable the APNS channel.

Here is the error.json, it is not so descriptive unfortunately.

{
    "name": "NotificationsChannelAPNSFault",
    "classification": "FAULT",
    "options": {
        "message": "Failed to enable the APNS channel."
    },
    "downstreamException": {
        "message": "Resource not found",
        "code": "NotFoundException",
        "[Message]": "See error.Message for details.",
        "time": "2024-01-07T22:51:14.982Z",
        "requestId": "88b86af3-589f-467f-ba97-ada798194368",
        "statusCode": 404,
        "retryable": false,
        "retryDelay": 31.504166553577573
    },
    "link": "https://docs.amplify.aws/cli/project/troubleshooting/"
}

Please help.

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Okay I believe I got this issue resolved. The problem is about the line ending difference between Unix vs Windows. (aka LF vs CRLF).

Context My git defaults to checkout the remote code (in LF) automatically converted to CRLF with default set up git config core.autocrlf true.

Solution I removed my local git repo, then set git config core.autocrlf input, which will make git checking out the line breaking as it is. Now the newly cloned repo’s line ending will be in LF because the repo was initialized in MacOS.

Checkout as-is, commit Unix-style

Git will not perform any conversion when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects this is the recommended setting on Unix (“core.autocrlf” is set to “input”).

After so, I re-ran amplify pull --appId xxxxx--envName dev --debug and everything went through smoothly.

How I discover this When I was blocked, I tried to do amplify init --appId xxxxx instead of amplify pull. The cli ran through but it messed up the line endings of everything in ./amplify/backend, which makes me realized that my local repo is checked out as CRLF while Amplify-CLI init/pull with LF.

So I re-cloned, and the issues is gone.

Working Theory My guess is that the APNS resource, which was not found, probably has an id stored in some of the file, and the CRLF ending confused Amplify as it may expect LF ending. @ykethan you may try to reproduce by changing the ending of the file, where APNS is described, into CRLF and see whether you get the same "Resource not found"error.