Skip to content

Events Queue Setup & Configuration #240

Closed

Description

@bpcsys

Hello am facing issues trying to set this up on my GCP, I enabled Google Cloud Tasks, also have the Firebase Admin Credentials.
But My Cloud Build Fails at the step of Cloud Tasks Client, I tried to at the logs but couldn't get any meaning full error.

{
    "pid": "1",
    "service.name": "*di.Container",
    "caller": "/http-sms/pkg/di/container.go:298",
    "error": "cannot initialize cloud tasks client\n --- at /http-sms/pkg/di/container.go:298 (Container.CloudTasksClient) ---\nCaused by: invalid character 'b' looking for beginning of value",
    "hostname": "localhost"
  }

I have also setup the environment variables.

EVENTS_QUEUE_TYPE=Push
EVENTS_QUEUE_USER_API_KEY=<here i used the one from the json crendetial got from firebase admin>
EVENTS_QUEUE_NAME=send-sms
EVENTS_QUEUE_USER_ID=<here i used the one from the json crendetial got from firebase admin>
EVENTS_QUEUE_ENDPOINT=projects/[PROJECT_ID]/locations/[LOCATION_ID]/queues/send-sms

Need your help. Thank You

Activity

  1. AchoArnold commented on Jul 12, 2023

    @AchoArnold
    Member

    Hello @bpcsys
    Are you a Go programmer, if yes, look at how the queue is configured here https://github.com/NdoleStudio/httpsms/blob/main/api/pkg/di/container.go
    I plan to improve the local setup instructions under #42 but I'm busy with other issues at the moment.

  2. bpcsys commented on Jul 13, 2023

    @bpcsys
    Author

    Actually I am not a Go Programmer but thanks to your Well Documented code I was able to read and understand the code.
    And here my main issue was that I wrongly set FIREBASE_CRENDENTIALS to a path instead of the actually JSON File.
    Am Looking forward to learning go so that we can add more features to this. Thanks Alot!

  3. bpcsys commented on Jul 15, 2023

    @bpcsys
    Author

    @AchoArnold If you happen to have time just help me find out what am doing wrong after setting up everything. I came to this issue that appeared when I Tried to send the message.

    {
    caller: "/http-sms/pkg/handlers/message_handler.go:99"
    pid: "1"
    hostname: "localhost"
    error: "cannot send message with paylod [{"to":"+256761585999","from":"+256784007449","content":"Just a Test Message","sim":"DEFAULT"}]
     --- at /http-sms/pkg/handlers/message_handler.go:99 (MessageHandler.PostSend) ---
    Caused by: cannot dispatch event type [message.api.sent] and id [37b8c7cb-dde6-4d6b-8c9d-3463e3d0bdd2]
     --- at /http-sms/pkg/services/message_service.go:336 (MessageService.SendMessage) ---
    Caused by: cannot enqueue event with ID [37b8c7cb-dde6-4d6b-8c9d-3463e3d0bdd2] and type [message.api.sent]
     --- at /http-sms/pkg/services/event_dispatcher_service.go:83 (EventDispatcher.DispatchWithTimeout) ---
    Caused by: cannot schedule task {"specversion":"1.0","id":"37b8c7cb-dde6-4d6b-8c9d-3463e3d0bdd2","source":"/v1/messages/send","type":"message.api.sent","datacontenttype":"application/json","time":"2023-07-15T06:51:20.945343849Z","data":{"message_id":"a3029903-e144-455f-ad92-d891a0b7ef6c","user_id":"3UpI85bZaHXa1tXOiSR8YdFJ9783","owner":"+256784007449","max_send_attempts":2,"contact":"+256761585999","request_received_at":"2023-07-15T06:51:20.914974782Z","content":"Just a Test Message","sim":"SIM1"}} to URL: projects/bpc-management-system/locations/us-central1/queues/send-sms
     --- at /http-sms/pkg/services/google_cloud_push_queue_service.go:73 (googlePushQueue.Enqueue) ---
    Caused by: rpc error: code = PermissionDenied desc = Cloud Tasks API has not been used in project 25699032575 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudtasks.googleapis.com/overview?project=25699032575 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
    error details: name = ErrorInfo reason = SERVICE_DISABLED domain = googleapis.com metadata = map[consumer:projects/25699032575 service:cloudtasks.googleapis.com]
    error details: name = Help desc = Google developers console API activation url = https://console.developers.google.com/apis/api/cloudtasks.googleapis.com/overview?project=25699032575"
    service.name: "*handlers.MessageHandler"
    }
    

    I the PROJECT_ID set to my project ID and When I read the log I see another PROJECT_ID 25699032575 which seems to be an internal googl project id.
    Am wondering where it comes from.

  4. AchoArnold commented on Jul 23, 2023

    @AchoArnold
    Member

    @bpcsys see the comment on #249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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