Skip to content

ERROR: ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR: null value in column "service_name" violates not-null constraint #43406

Closed
@Suraj-Chandola

Description

@Suraj-Chandola

Getting
ERROR: ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR: null value in column "service_name" violates not-null constraint
When calling .attach(io: File.open('/path/to/file'), filename: 'file.pdf') from Worker
Worker is called using .perform_async

CODE:

class User < ApplicationRecord
  has_one_attached :avatar
end

user.avatar.attach(io: File.open('/path/to/file'), filename: 'file.pdf')

user.avatar.attach is called from sidekiq worker

Getting
ERROR: ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR: null value in column "service_name" violates not-null constraint

System configuration

Rails version: 6.1.4:

Ruby version: 2.5.0:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions