mileszs/wicked_pdf · error · WickedPdf::WickedPdfHelper::Assets::MissingRemoteAsset

Could not fetch asset '#{url}': server responded with #{resp

Error message

Could not fetch asset '#{url}': server responded with #{response.code} #{response.message}

What it means

Error "Could not fetch asset '#{url}': server responded with #{response.code} #{response.message}" thrown in mileszs/wicked_pdf.

Source

Thrown at lib/wicked_pdf/wicked_pdf_helper/assets.rb:268

          return
        end

        pathname = asset_pathname(source)
        if pathname =~ URI_REGEXP
          read_from_uri(pathname)
        elsif File.file?(pathname)
          IO.read(pathname)
        elsif WickedPdf.config[:raise_on_missing_assets]
          raise MissingLocalAsset, pathname if WickedPdf.config[:raise_on_missing_assets]
        end
      end

      def read_from_uri(uri)
        response = Net::HTTP.get_response(URI(uri))

        unless response.is_a?(Net::HTTPSuccess)
          raise MissingRemoteAsset.new(uri, response) if WickedPdf.config[:raise_on_missing_assets]

          return
        end

        asset = response.body
        asset.force_encoding('UTF-8') if asset
        asset = gzip(asset) if WickedPdf.config[:expect_gzipped_remote_assets]
        asset
      end

      def gzip(asset)
        stringified_asset = StringIO.new(asset)
        gzipper = Zlib::GzipReader.new(stringified_asset)
        gzipper.read
      rescue Zlib::GzipFile::Error
        nil
      end

View on GitHub (pinned to bce498de54)

When it happens

Trigger: Thrown at lib/wicked_pdf/wicked_pdf_helper/assets.rb:268 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mileszs/wicked_pdf@bce498de54 (2026-08-23). Data as JSON: /api/errors/71128c6c63921fc4. Report an issue: GitHub.