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

encoding problem in recording_ready_notifier_service #1016

Open
afelpeto opened this issue Aug 24, 2023 · 0 comments
Open

encoding problem in recording_ready_notifier_service #1016

afelpeto opened this issue Aug 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@afelpeto
Copy link

Describe the bug
When scalelite tries to send a notification to greenlight in order to let it know that the new recordings are available, greenlight returns a 500 error.

Steps to reproduce the behavior:
Just record a meeting with bigbluebutton and wait until it is processed and post_published to scalelite.

Once scalelite unpacks de spool file and inserts all the data o the database, it is sent a POST to https://GREENLIGHT_HOST/recording_ready

Greenlight returns something like this:

I, [2023-08-24T13:36:44.668928 #158] INFO -- : [a22d8093-bdfa-4547-bfe5-b957c8acd4d5] method=POST path=/recording_ready format=/ controller=ExternalController action=recording_ready status=500 allocations=2056 duration=62.76 view=0.00 db=4.26 time=2023-08-24 13:36:44 UTC host=greenlight
F, [2023-08-24T13:36:44.670347 #158] FATAL -- : [a22d8093-bdfa-4547-bfe5-b957c8acd4d5]
[a22d8093-bdfa-4547-bfe5-b957c8acd4d5] NoMethodError (undefined method []' for nil:NilClass): [a22d8093-bdfa-4547-bfe5-b957c8acd4d5] [a22d8093-bdfa-4547-bfe5-b957c8acd4d5] app/services/recording_creator.rb:25:in call'
[a22d8093-bdfa-4547-bfe5-b957c8acd4d5] app/controllers/external_controller.rb:93:in `recording_ready'

Scalelite-recording-importer shows:

I, [2023-08-24T13:36:44.576407 #7] INFO -- : Recording Ready Notify for [zyxhbx9q60cmdi8btaf0eokcmpzsel2ndldnlk3y] starts
I, [2023-08-24T13:36:44.576449 #7] INFO -- : Making callback for recording ready notification
I, [2023-08-24T13:36:44.577499 #7] INFO -- : Sending request to https://MY-GREENLIGHT/recording_ready
I, [2023-08-24T13:36:44.671697 #7] INFO -- : Callback HTTP request failed: 500 Internal Server Error (code 500)

Deployment:

  1. Haproxy server (public ip) serving connections towards greenlight v3.0.6 (docker deployment)(private ip)
  2. Scalelite v1.5.1.5 (docker deployment) configured with public ip (no tenants)
  3. 3 BBB 2.6 servers (traditional setup) configured with public ip per host

Expected behavior
Greenlight should return

I, [2023-08-24T13:36:45.274107 #158] INFO -- : [47426e61-ca9e-463c-bc7d-bef4a733934a] method=POST path=/recording_ready format=/ controller=ExternalController action=recording_ready status=200 allocations=8125 duration=108.14 view=4.27 db=26.19 time=2023-08-24 13:36:45 UTC host=greenlight
I, [2023-08-24T13:36:45.830841 #158] INFO -- : BigBlueButtonAPI: request=https://MY-SCALELITE/bigbluebutton/api/getRecordings?recordID=1bf3973c5430f1b513334fc8288bef8635ba79a1-1692884157778&checksum=ad5ca096925b5df5630e0223aedcdd4e25814866 response_status=Net::HTTPOK response_code=200 message_key=OK

scalelite-recording-importer should return:

I, [2023-08-24T13:36:45.147553 #7] INFO -- : Recording Ready Notify for [zyxhbx9q60cmdi8btaf0eokcmpzsel2ndldnlk3y] starts
I, [2023-08-24T13:36:45.147609 #7] INFO -- : Making callback for recording ready notification
I, [2023-08-24T13:36:45.148003 #7] INFO -- : Sending request to https://MY-GREENLIGHT/recording_ready
I, [2023-08-24T13:36:45.274474 #7] INFO -- : Recording notifier successful: zyxhbx9q60cmdi8btaf0eokcmpzsel2ndldnlk3y (code 200)

source code from scalelite (app/services/recording_ready_notifier_service.rb)
Scalelite encodes without using any algorithm

    def encoded_payload(meeting_id, record_id, tenant_name)
      secret = fetch_secrets(tenant_name: tenant_name)[0]
      payload = { meeting_id: meeting_id, record_id: record_id }
      JWT.encode(payload, secret)
    end

source code from greenlight (app/services/big_blue_button_api.rb)
Meanwhile greenlight decodes the BBB/scalelite response using HS256

  def decode_jwt(token)
    JWT.decode token, @secret, true, { algorithm: 'HS256' }
  end

SOLUTION on app/services/recording_ready_notifier_service.rb
JWT.encode(payload, secret,'HS256')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant