Skip to content

Instructions for push.yml config are not clear enough #33

@fabianoarruda

Description

@fabianoarruda

I've been trying to use this gem with google FCM, but I can't get it to initialize. In the readme example, you have encryption_key: your_service_account_json_file, which I assume is instructing me to point to a json file. I downloaded the file from Firebase account console, as instructed in the linked docs. But no matter how I try, it always gives me yaml parsing errors.

the file I got from firebase is like this:

{
  "type": "service_account",
  "project_id": "my-project-abc123",
  "private_key_id": "some_key",
  "private_key": "-----BEGIN PRIVATE KEY-----
long_chars_sequence
-----END PRIVATE KEY-----\n",
  "client_email": "firebase-adminsdk-fbsvc@my-project-abc123.iam.gserviceaccount.com",
  "client_id": "123456",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-fbsvc%40my-project-abc123.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}

I saved it as config/firebase-credentials.json

Here is my push.yml file:

shared:
  google:
    # Your Firebase project service account credentials
    # See https://firebase.google.com/docs/cloud-messaging/auth-server
    encryption_key: "<%= File.read(Rails.root.join('config/firebase-credentials.json')) %>"

    # Firebase project_id
    project_id: my-project-abc123

    # Change the request timeout (default: 15).
    # request_timeout: 30

Here is the error I get when trying to send the notification:

`<main>': YAML syntax error occurred while parsing /Users/Fabiano/Dropbox/code/my_rails_app/config/push.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): did not find expected key while parsing a block mapping at line 2 column 3 (RuntimeError)
/Users/Fabiano/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/psych-5.2.6/lib/psych/parser.rb:62:in `_native_parse': (<unknown>): did not find expected key while parsing a block mapping at line 2 column 3 (Psych::SyntaxError)

Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions