Skip to content

Error when deleting project file #3523

@sentry

Description

@sentry

Sentry Issue: LIGHTNING-ZX

Oban exception:
%FunctionClauseError{module: URI, function: :encode, arity: 2, kind: nil, args: nil, clauses: nil}
    (elixir 1.18.3) lib/uri.ex:402: URI.encode(nil, &URI.char_unreserved?/1)
    (google_api_storage 0.46.0) lib/google_api/storage/v1/api/objects.ex:320: GoogleApi.Storage.V1.Api.Objects.storage_objects_delete/5
    (lightning 2.14.1-pre2) lib/lightning/projects.ex:905: anonymous fn/1 in Lightning.Projects.remove_expired_files_for/1
    (elixir 1.18.3) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
    (lightning 2.14.1-pre2) lib/lightning/projects.ex:904: Lightning.Projects.remove_expired_files_for/1
    (oban 2.19.1) lib/oban/queue/executor.ex:145: Oban.Queue.Executor.perform/1
    (oban 2.19.1) lib/oban/queue/executor.ex:77: Oban.Queue.Executor.call/1
    (elixir 1.18.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2

meta:
  %{
  args: %{
    "project_id" => "5776895c-4307-4790-8c56-7d1d223b280f",
    "type" => "data_retention"
  },
  id: 1981315,
  reason: %FunctionClauseError{
    module: URI,
    function: :encode,
    arity: 2,
    kind: nil,
    args: nil,
    clauses: nil
  },
  state: :discard,
  max_attempts: 3,
  queue: "background",
  worker: "Lightning.Projects",
  prefix: "public",
  result: nil,
  conf: %Oban.Config{
    dispatch_cooldown: 100,
    engine: Oban.Engines.Basic,
    get_dynamic_repo: nil,
    insert_trigger: true,
    log: false,
    name: Lightning.Oban,
    node: "[email]",
    notifier: {Oban.Notifiers.Postgres, []},
    peer: {Oban.Peers.Database, []},
    plugins: [
      {Oban.Plugins.Cron,
       [
         crontab: [
           {"* * * * *", Lightning.Workflows.Scheduler},
           {"* * * * *", ObanPruner},
           {"*/5 * * * *", Lightning.Janitor},
           {"0 10 * * *", Lightning.DigestEmailWorker,
            [args: %{"type" => "daily_project_digest"}]},
           {"0 10 * * 1", Lightning.DigestEmailWorker,
            [args: %{"type" => "weekly_project_digest"}]},
           {"0 10 1 * *", Lightning.DigestEmailWorker,
            [args: %{"type" => "monthly_project_digest"}]},
           {"17 */2 * * *", Lightning.Projects,
            [args: %{"type" => "data_retention"}]},
           {"*/10 * * * *",
            Lightning.KafkaTriggers.DuplicateTrackingCleanupWorker},
           {"15 2 * * *", Lightning.Accounts,
            [args: %{"type" => "purge_deleted"}]},
           {"30 2 * * *", Lightning.Credentials,
            [args: %{"type" => "purge_deleted"}]},
           {"45 2 * * *", Lightning.Projects,
            [args: %{"type" => "purge_deleted"}]},
           {"0 3 * * *", Lightning.WebhookAuthMethods,
            [args: %{"type" => "purge_deleted"}]}
         ]
       ]}
    ],
    prefix: "public",
    queues: [
      scheduler: [limit: 1],
      workflow_failures: [limit: 1],
      background: [limit: 1],
      history_exports: [limit: 1],
      ai_assistant: [limit: 10]
    ],
    repo: Lightning.Repo,
    shutdown_grace_period: 120000,
    stage_interval: 1000,
    testing: :disabled
  },
  kind: :error,
  job: %Oban.Job{
    __meta__: #Ecto.Schema.Metadata<:loaded, "public", "oban_jobs">,
    id: 1981315,
    state: "executing",
    queue: "background",
    worker: "Lightning.Projects",
    args: %{
      "project_id" => "5776895c-4307-4790-8c56-7d1d223b280f",
      "type" => "data_retention"
    },
    meta: %{},
    tags: [],
    errors: [
      %{
        "at" => "2025-08-14T08:17:06.022255Z",
        "attempt" => 1,
        "error" => "** (FunctionClauseError) no function clause matching in URI.encode/2\n\nThe following arguments were given to URI.encode/2:\n\n    # 1\n    nil\n\n    # 2\n    &URI.char_unreserved?/1\n\n    (elixir 1.18.3) lib/uri.ex:402: URI.encode/2\n    (google_api_storage 0.46.0) lib/google_api/storage/v1/api/objects.ex:320: GoogleApi.Storage.V1.Api.Objects.storage_objects_delete/5\n    (lightning 2.14.1-pre2) lib/lightning/projects.ex:905: anonymous fn/1 in Lightning.Projects.remove_expired_files_for/1\n    (elixir 1.18.3) lib/enum.ex:987: Enum.\"-each/2-lists^foreach/1-0-\"/2\n    (lightning 2.14.1-pre2) lib/lightning/projects.ex:904: Lightning.Projects.remove_expired_files_for/1\n    (oban 2.19.1) lib/oban/queue/executor.ex:145: Oban.Queue.Executor.perform/1\n    (oban 2.19.1) lib/oban/queue/executor.ex:77: Oban.Queue.Executor.call/1\n    (elixir 1.18.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2\n"
      },
      %{
        "at" => "2025-08-14T08:17:23.527902Z",
        "attempt" => 2,
        "error" => "** (FunctionClauseError) no function clause matching in URI.encode/2\n\nThe following arguments were given to URI.encode/2:\n\n    # 1\n    nil\n\n    # 2\n    &URI.char_unreserved?/1\n\n    (elixir 1.18.3) lib/uri.ex:402: URI.encode/2\n    (google_api_storage 0.46.0) lib/google_api/storage/v1/api/objects.ex:320: GoogleApi.Storage.V1.Api.Objects.storage_objects_delete/5\n    (lightning 2.14.1-pre2) lib/lightning/projects.ex:905: anonymous fn/1 in Lightning.Projects.remove_expired_files_for/1\n    (elixir 1.18.3) lib/enum.ex:987: Enum.\"-each/2-lists^foreach/1-0-\"/2\n    (lightning 2.14.1-pre2) lib/lightning/projects.ex:904: Lightning.Projects.remove_expired_files_for/1\n    (oban 2.19.1) lib/oban/queue/executor.ex:145: Oban.Queue.Executor.perform/1\n    (oban 2.19.1) lib/oban/queue/executor.ex:77: Oban.Queue.Executor.call/1\n    (elixir 1.18.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2\n"
      }
    ],
    attempt: 3,
    attempted_by: ["[email]",
     "3d146caf-bb2b-4612-945f-b2d403e469bc"],
    max_attempts: 3,
    priority: 0,
    attempted_at: ~U[2025-08-14 08:17:43.219529Z],
    cancelled_at: nil,
    completed_at: nil,
    discarded_at: nil,
    inserted_at: ~U[2025-08-14 08:17:00.521628Z],
    scheduled_at: ~U[2025-08-14 08:17:42.527917Z],
    conf: %Oban.Config{
      dispatch_cooldown: 100,
      engine: Oban.Engines.Basic,
      get_dynamic_repo: nil,
      insert_trigger: true,
      log: false,
      name: Lightning.Oban,
      node: "[email]",
      notifier: {Oban.Notifiers.Postgres, []},
      peer: {Oban.Peers.Database, []},
      plugins: [
        {Oban.Plugins.Cron,
         [
           crontab: [
             {"* * * * *", Lightning.Workflows.Scheduler},
             {"* * * * *", ObanPruner},
             {"*/5 * * * *", ...},
             {...},
             ...
           ]
         ]}
      ],
      prefix: "public",
      queues: [
        scheduler: [limit: 1],
        workflow_failures: [limit: 1],
        background: [limit: 1],
        history_exports: [limit: 1],
        ai_assistant: [limit: 10]
      ],
      repo: Lightning.Repo,
      shutdown_grace_period: 120000,
      stage_interval: 1000,
      testing: :disabled
    },
    conflict?: false,
    replace: nil,
    unique: nil,
    unsaved_error: %{
      reason: %FunctionClauseError{
        module: URI,
        function: :encode,
        arity: 2,
        kind: nil,
        args: nil,
        clauses: nil
      },
      stacktrace: [
        {URI, :encode, [nil, &URI.char_unreserved?/1],
         [file: ~c"lib/uri.ex", line: 402]},
        {GoogleApi.Storage.V1.Api.Objects, :storage_objects_delete, 5,
         [file: ~c"lib/google_api/storage/v1/api/objects.ex", line: 320]},
        {Lightning.Projects, :"-remove_expired_files_for/1-fun-0-", 1,
         [file: ~c"lib/lightning/projects.ex", line: 905]},
        {Enum, :"-each/2-lists^foreach/1-0-", 2,
         [file: ~c"lib/enum.ex", line: 987]},
        {Lightning.Projects, :remove_expired_files_for, 1,
         [file: ~c"lib/lightning/projects.ex", line: 904]},
        {Oban.Queue.Executor, :perform, 1,
         [file: ~c"lib/oban/queue/executor.ex", line: 145]},
        {Oban.Queue.Executor, :call, 1,
         [file: ~c"lib/oban/queue/executor.ex", ...]},
        {Task.Supervised, :invoke_mfa, 2, [...]}
      ],
      kind: :error
    }
  },
  attempt: 3,
  tags: []
}
(%{
  memory: 197304,
  reductions: 33676169,
  duration: 93524374,
  queue_time: 691612000
})

Metadata

Metadata

Labels

bugNewly identified bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions