这是indexloc提供的服务,不要输入任何密码
Skip to content

uninitialized constant LiveKit::AccessToken #75

@alec-c4

Description

@alec-c4

Hi!
I'm facing exception uninitialized constant LiveKit::AccessToken for the following code

controller:

  def show
    @token = LiveKit::CreateToken.run!(
      token_identity: current_user.to_s,
      token_name: @meeting.id,
      room_name: @meeting.id
    )
  end 

interactor:

require "livekit"

class LiveKit::CreateToken < ActiveInteraction::Base
  string :token_identity
  string :token_name
  string :room_name

  validates :token_identity, presence: true
  validates :token_name, presence: true
  validates :room_name, presence: true

  def execute
    token = LiveKit::AccessToken.new(
      api_key: Rails.application.credentials.livekit[:api_key],
      api_secret: Rails.application.credentials.livekit[:api_secret]
    )
    token.identity = token_identity
    token.name = token_name
    token.add_grant(roomJoin: true, room: room_name)

    token.to_jwt
  end
end

But it looks like an issue with memory management, because when I do restart my app - problem is gone.

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