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

Could not connect to GCM: The operation couldn’t be completed. (com.google.gcm error 501.) #205

Closed
alexszilagyi opened this issue Apr 20, 2016 · 9 comments

Comments

@alexszilagyi
Copy link

alexszilagyi commented Apr 20, 2016

I have downloaded the iOS example and tested Swift & Objective-C but none of them prove to work from the first run;

I am getting the following error message: Error registering with the GCM (The operation couldn't be completed. (com.google.iid. error 7.), based on documentation means Unknown error. Any clue?

Error registering with GCM.

Swift app log output:

2016-04-20 14:32:43.297 GcmExampleSwift[443:501] <GMR/INFO> App measurement v.2003000 started
2016-04-20 14:32:43.299 GcmExampleSwift[443:501] <GMR/INFO> To enable debug logging set the following application argument: -GMRDebugEnabled (see http://goo.gl/Y0Yjwu)
2016-04-20 14:32:43.300 GcmExampleSwift[443:501] <GMR/DEBUG> Debug logging enabled
2016-04-20 14:32:43.301 GcmExampleSwift[443:501] <GMR/DEBUG> App measurement is monitoring the network status
2016-04-20 14:32:43.346: GCM | GCM library version 1.1.4
2016-04-20 14:32:43.351 GcmExampleSwift[443:501] <GMR/DEBUG> Uploading data to the measurement server
2016-04-20 14:32:43.581: GCM | GCM registration is not ready with auth credentials
2016-04-20 14:32:43.584 GcmExampleSwift[443:501] <GMR/DEBUG> Network status has changed. code, status: 2, Connected
2016-04-20 14:32:43.585 GcmExampleSwift[443:501] <GMR/DEBUG> Network status has changed. code, status: 2, Connected
Could not connect to GCM: The operation couldn’t be completed. (com.google.gcm error 501.)
2016-04-20 14:32:43.617 GcmExampleSwift[443:501] <GMR/DEBUG> Uploading data to the measurement server
2016-04-20 14:32:43.796 GcmExampleSwift[443:501] <GMR/DEBUG> Configuration is not found in database
2016-04-20 14:32:43.797 GcmExampleSwift[443:501] <GMR/DEBUG> App measurement is ready to receive events
2016-04-20 14:32:43.804 GcmExampleSwift[443:501] <GMR/DEBUG> Setting user property: _fot, 1461153600000
2016-04-20 14:32:43.829 GcmExampleSwift[443:501] <GMR/DEBUG> User property set: _fot, 1461153600000
2016-04-20 14:32:43.840 GcmExampleSwift[443:501] <GMR/DEBUG> Logging event: origin, name, params: auto, _f, {
        "_c" = 1;
        "_o" = auto;
    }
2016-04-20 14:32:43.854 GcmExampleSwift[443:501] <GMR/DEBUG> Event logged. Event name, event params: _f, {
        "_c" = 1;
        "_o" = auto;
    }
2016-04-20 14:32:43.865 GcmExampleSwift[443:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 14.93843394517899
2016-04-20 14:32:43.866 GcmExampleSwift[443:501] <GMR/DEBUG> Upload task scheduled to be executed in approx. (s): 14.93843394517899
2016-04-20 14:32:43.870 GcmExampleSwift[443:501] <GMR/DEBUG> Do not schedule an upload task. Task already exists
2016-04-20 14:32:43.871 GcmExampleSwift[443:501] <GMR/DEBUG> Scheduling session start timer
2016-04-20 14:32:43.871 GcmExampleSwift[443:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 10
2016-04-20 14:32:43.872 GcmExampleSwift[443:501] <GMR/DEBUG> Scheduling user engagement timer
2016-04-20 14:32:43.872 GcmExampleSwift[443:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 3600
2016-04-20 14:32:43.872 GcmExampleSwift[443:501] <GMR/INFO> App measurement enabled
2016-04-20 14:32:43.958: GGLInstanceID | Invalid last checkin timestamp in future.
2016-04-20 14:32:43.980: GGLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "The operation couldn’t be completed. (com.google.iid error -25300.)"
2016-04-20 14:32:45.107: GGLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "The operation couldn’t be completed. (com.google.iid error -25300.)"
Registration to GCM failed with error: The operation couldn’t be completed. (com.google.iid error 7.)
2016-04-20 14:32:53.872 GcmExampleSwift[443:501] <GMR/DEBUG> Timer fired
2016-04-20 14:32:53.875 GcmExampleSwift[443:501] <GMR/DEBUG> Canceling active timer
2016-04-20 14:32:53.876 GcmExampleSwift[443:501] <GMR/DEBUG> Logging event: origin, name, params: auto, _s, {
        "_o" = auto;
    }
2016-04-20 14:32:53.892 GcmExampleSwift[443:501] <GMR/DEBUG> Event logged. Event name, event params: _s, {
        "_o" = auto;
    }
2016-04-20 14:32:53.904 GcmExampleSwift[443:501] <GMR/DEBUG> Do not schedule an upload task. Task already exists
2016-04-20 14:32:58.805 GcmExampleSwift[443:501] <GMR/DEBUG> Timer fired
2016-04-20 14:32:58.807 GcmExampleSwift[443:501] <GMR/DEBUG> Canceling active timer
2016-04-20 14:32:58.808 GcmExampleSwift[443:501] <GMR/DEBUG> Starting data upload
2016-04-20 14:32:58.810 GcmExampleSwift[443:501] <GMR/DEBUG> No data to upload
2016-04-20 14:32:58.812 GcmExampleSwift[443:501] <GMR/DEBUG> Fetching configuration from the server
2016-04-20 14:32:58.823 GcmExampleSwift[443:501] <GMR/DEBUG> Fetching data from collection end point
2016-04-20 14:32:59.165 GcmExampleSwift[443:501] <GMR/INFO> Fetched configuration. Status code: 200
2016-04-20 14:32:59.166 GcmExampleSwift[443:501] <GMR/INFO> Successful fetched configuration from the server. Got network response. code, size: 200, 124
2016-04-20 14:32:59.239 GcmExampleSwift[443:501] <GMR/DEBUG> Starting data upload
2016-04-20 14:32:59.260 GcmExampleSwift[443:501] <GMR/DEBUG> Saving bundle. size (bytes): 291
2016-04-20 14:32:59.262 GcmExampleSwift[443:501] <GMR/DEBUG> Event added to the upload queue. BundleID, timestamp (ms): 1, 1461151973872
2016-04-20 14:32:59.290 GcmExampleSwift[443:501] <GMR/DEBUG> Measurement data sent to network. timestamp (ms), data: 1461151979284, <ACPMeasurementBatch 0x1740b3380>: {
        bundles {
          protocol_version: 1
          events {
            params {
              name: "_c"
              int_value: 1
            }
            params {
              name: "_o"
              string_value: "auto"
            }
            name: "_f"
            timestamp_millis: 1461151963803
          }
          events {
            params {
              name: "_o"
              string_value: "auto"
            }
            name: "_s"
            timestamp_millis: 1461151973872
          }
          user_attributes {
            set_timestamp_millis: 1461151963803
            name: "_fot"
            int_value: 1461153600000
          }
          upload_timestamp_millis: 1461151979284
          start_timestamp_millis: 1461151963803
          end_timestamp_millis: 1461151973872
          platform: "ios"
          os_version: "8.4.1"
          device_model: "iPhone7,2"
          user_default_language: "en"
          time_zone_offset_minutes: 180
          app_store: "manual_install"
          app_id: "com.myapp.Myapp"
          app_version: "1.0.1"
          gmp_version: 2003
          uploading_gmp_version: 2003
          app_instance_id: "-------app_instance_id----------"
          dev_cert_hash: ---dev_cert_hash---
          bundle_sequential_index: 1
          gmp_app_id: "1:123456789012:ios:123abcde123d1dcc"
          vendor_device_id: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
          app_version_major: 1
        }
    }
2016-04-20 14:32:59.300 GcmExampleSwift[443:501] <GMR/DEBUG> Uploading data to the measurement server
2016-04-20 14:32:59.494 GcmExampleSwift[443:501] <GMR/DEBUG> Successful upload. Got network response. code, size: 204, 0
2016-04-20 14:32:59.502 GcmExampleSwift[443:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 3599.993515074253
2016-04-20 14:32:59.503 GcmExampleSwift[443:501] <GMR/DEBUG> Upload task scheduled to be executed in approx. (s): 3599.993515074253
2016-04-20 14:32:59.517 GcmExampleSwift[443:501] <GMR/DEBUG> No data to upload. Upload task will not be scheduled
2016-04-20 14:32:59.519 GcmExampleSwift[443:501] <GMR/DEBUG> Canceling active timer

and Objective-C example log output:

2016-04-20 14:36:33.127 GcmExample[458:501] <GMR/INFO> App measurement v.2003000 started
2016-04-20 14:36:33.128 GcmExample[458:501] <GMR/INFO> To enable debug logging set the following application argument: -GMRDebugEnabled (see http://goo.gl/Y0Yjwu)
2016-04-20 14:36:33.130 GcmExample[458:501] <GMR/DEBUG> Debug logging enabled
2016-04-20 14:36:33.130 GcmExample[458:501] <GMR/DEBUG> App measurement is monitoring the network status
2016-04-20 14:36:33.177: GCM | GCM library version 1.1.4
2016-04-20 14:36:33.186 GcmExample[458:501] <GMR/DEBUG> Uploading data to the measurement server
2016-04-20 14:36:33.449 GcmExample[458:501] <GMR/DEBUG> Network status has changed. code, status: 2, Connected
2016-04-20 14:36:33.450: GCM | GCM registration is not ready with auth credentials
2016-04-20 14:36:33.450 GcmExample[458:501] <GMR/DEBUG> Network status has changed. code, status: 2, Connected
2016-04-20 14:36:33.453 GcmExample[458:45269] Could not connect to GCM: The operation couldn’t be completed. (com.google.gcm error 501.)
2016-04-20 14:36:33.493 GcmExample[458:501] <GMR/DEBUG> Uploading data to the measurement server
2016-04-20 14:36:33.654 GcmExample[458:501] <GMR/DEBUG> Configuration is not found in database
2016-04-20 14:36:33.654 GcmExample[458:501] <GMR/DEBUG> App measurement is ready to receive events
2016-04-20 14:36:33.683 GcmExample[458:501] <GMR/DEBUG> Setting user property: _fot, 1461153600000
2016-04-20 14:36:33.687 GcmExample[458:501] <GMR/DEBUG> User property set: _fot, 1461153600000
2016-04-20 14:36:33.698 GcmExample[458:501] <GMR/DEBUG> Logging event: origin, name, params: auto, _f, {
        "_c" = 1;
        "_o" = auto;
    }
2016-04-20 14:36:33.717 GcmExample[458:501] <GMR/DEBUG> Event logged. Event name, event params: _f, {
        "_c" = 1;
        "_o" = auto;
    }
2016-04-20 14:36:33.728 GcmExample[458:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 14.95441710948944
2016-04-20 14:36:33.729 GcmExample[458:501] <GMR/DEBUG> Upload task scheduled to be executed in approx. (s): 14.95441710948944
2016-04-20 14:36:33.735 GcmExample[458:501] <GMR/DEBUG> Do not schedule an upload task. Task already exists
2016-04-20 14:36:33.735 GcmExample[458:501] <GMR/DEBUG> Scheduling session start timer
2016-04-20 14:36:33.737 GcmExample[458:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 10
2016-04-20 14:36:33.737 GcmExample[458:501] <GMR/DEBUG> Scheduling user engagement timer
2016-04-20 14:36:33.738 GcmExample[458:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 3600
2016-04-20 14:36:33.739 GcmExample[458:501] <GMR/INFO> App measurement enabled
2016-04-20 14:36:33.818: GGLInstanceID | Invalid last checkin timestamp in future.
2016-04-20 14:36:33.843: GGLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "The operation couldn’t be completed. (com.google.iid error -25300.)"
2016-04-20 14:36:34.498: GGLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "The operation couldn’t be completed. (com.google.iid error -25300.)"
2016-04-20 14:36:34.719 GcmExample[458:45269] Registration to GCM failed with error: The operation couldn’t be completed. (com.google.iid error 7.)
2016-04-20 14:36:43.736 GcmExample[458:501] <GMR/DEBUG> Timer fired
2016-04-20 14:36:43.737 GcmExample[458:501] <GMR/DEBUG> Canceling active timer
2016-04-20 14:36:43.738 GcmExample[458:501] <GMR/DEBUG> Logging event: origin, name, params: auto, _s, {
        "_o" = auto;
    }
2016-04-20 14:36:43.747 GcmExample[458:501] <GMR/DEBUG> Event logged. Event name, event params: _s, {
        "_o" = auto;
    }
2016-04-20 14:36:43.762 GcmExample[458:501] <GMR/DEBUG> Do not schedule an upload task. Task already exists
2016-04-20 14:36:48.683 GcmExample[458:501] <GMR/DEBUG> Timer fired
2016-04-20 14:36:48.684 GcmExample[458:501] <GMR/DEBUG> Canceling active timer
2016-04-20 14:36:48.685 GcmExample[458:501] <GMR/DEBUG> Starting data upload
2016-04-20 14:36:48.686 GcmExample[458:501] <GMR/DEBUG> No data to upload
2016-04-20 14:36:48.687 GcmExample[458:501] <GMR/DEBUG> Fetching configuration from the server
2016-04-20 14:36:48.696 GcmExample[458:501] <GMR/DEBUG> Fetching data from collection end point
2016-04-20 14:36:48.797 GcmExample[458:501] <GMR/INFO> Fetched configuration. Status code: 200
2016-04-20 14:36:48.798 GcmExample[458:501] <GMR/INFO> Successful fetched configuration from the server. Got network response. code, size: 200, 124
2016-04-20 14:36:48.854 GcmExample[458:501] <GMR/DEBUG> Starting data upload
2016-04-20 14:36:48.865 GcmExample[458:501] <GMR/DEBUG> Saving bundle. size (bytes): 291
2016-04-20 14:36:48.866 GcmExample[458:501] <GMR/DEBUG> Event added to the upload queue. BundleID, timestamp (ms): 1, 1461152203735
2016-04-20 14:36:48.885 GcmExample[458:501] <GMR/DEBUG> Measurement data sent to network. timestamp (ms), data: 1461152208883, <ACPMeasurementBatch 0x1702a6b40>: {
        bundles {
          protocol_version: 1
          events {
            params {
              name: "_c"
              int_value: 1
            }
            params {
              name: "_o"
              string_value: "auto"
            }
            name: "_f"
            timestamp_millis: 1461152193682
          }
          events {
            params {
              name: "_o"
              string_value: "auto"
            }
            name: "_s"
            timestamp_millis: 1461152203735
          }
          user_attributes {
            set_timestamp_millis: 1461152193682
            name: "_fot"
            int_value: 1461153600000
          }
          upload_timestamp_millis: 1461152208883
          start_timestamp_millis: 1461152193682
          end_timestamp_millis: 1461152203735
          platform: "ios"
          os_version: "8.4.1"
          device_model: "iPhone7,2"
          user_default_language: "en"
          time_zone_offset_minutes: 180
          app_store: "manual_install"
          app_id: "com.myapp.Myapp"
          app_version: "1.0.1"
          gmp_version: 2003
          uploading_gmp_version: 2003
          app_instance_id: "-------app_instance_id----------"
          dev_cert_hash: ---dev_cert_hash---
          bundle_sequential_index: 1
          gmp_app_id: "1:123456789012:ios:123abcde123d1dcc"
          vendor_device_id: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
          app_version_major: 1
        }
    }
2016-04-20 14:36:48.890 GcmExample[458:501] <GMR/DEBUG> Uploading data to the measurement server
2016-04-20 14:36:48.952 GcmExample[458:501] <GMR/DEBUG> Successful upload. Got network response. code, size: 204, 0
2016-04-20 14:36:48.955 GcmExample[458:501] <GMR/DEBUG> Timer scheduled to fire in approx. (s): 3599.996898114681
2016-04-20 14:36:48.955 GcmExample[458:501] <GMR/DEBUG> Upload task scheduled to be executed in approx. (s): 3599.996898114681
2016-04-20 14:36:48.968 GcmExample[458:501] <GMR/DEBUG> No data to upload. Upload task will not be scheduled
2016-04-20 14:36:48.968 GcmExample[458:501] <GMR/DEBUG> Canceling active timer

Mentions:

@earlyfai
Copy link

similar problem, wanna know its status and how to solve.

@alexszilagyi
Copy link
Author

@earlyfai : Its better to keep on eye on this issue. I don't have any input for now....

@urjitbhatia
Copy link

Hey guys, we are also having this problem.
GCM: Could not connect to GCM: The operation couldn?t be completed. (com.google.gcm error 501.)

Any fixes here?

@alexszilagyi
Copy link
Author

@urjitbhatia : Can you follow all comments related to this issue. In my case it was three major changes:

  1. ReCreate the certificates and re-upload them on GCM
  2. Download again the certificates
  3. Adjust code signing accordingly

See those steps if it helps.

@urjitbhatia
Copy link

@alexszilagyi still stuck with the same problem. We get the 501s for a bit I think and then eventually it succeeds registering with gcm.
@mohitsharma0690: do you have any ideas ^^
CC: @blakeanderson

@iamakashrao
Copy link

@alexszilagyi @urjitbhatia i have created new certificates still am getting the same error is there any fix for this

@mohitsharma0690
Copy link

501 means that the app is missing an id that GCM needs requires. The error code 7 is a known problem which occurs because of replication delay on our backend. If you guys are facing issues with this I would suggest moving to the new Firebase Cloud Messaging libraries. We don't expose these errors in the new library and we all the auto-retry and fetch stuff is in it so you wouldn't have to worry about these errors.

Also for the 501 problem does it happen all the time or on first install etc e.g. error code 7 should only happen on first install.

@urjitbhatia
Copy link

@iamakashrao We found the fix - if you enable detailed debug logging you will probably see a message saying something about using the instance id too soon. Once you make the call to the IID api you have wait for a bit before starting to use it to register with GCM. We put in a retry loop with some delay upfront and the problem was gone.

@iamakashrao
Copy link

iamakashrao commented Jun 25, 2016

will try that thanks @urjitbhatia - can you please share some code snippets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants