Skip to content

Entry destroy not working as expected #221

Description

Unpublish & archive working but destroy results in this error FrozenError (can't modify frozen String: ""). Tried unpublishing and/or archiving first, but destroy still failed. Is there some other config or process to destroy entries?

module ContentfulAdapter
  module Management
    module DeleteEntries
      module_function

      def delete_all(entry_type:)
        cms_client = ContentfulAdapter::Management::CreateClient.call
        space = cms_client.spaces.find(ENV['CONTENTFUL_SPACE'])
        entries = space.entries.all(content_type: entry_type)

        entries.each do |entry|
          entry.unpublish
          entry.destroy
        end
      end
    end
  end
end

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