Skip to content

Oracle Enhanced 8.0.0 + Solid Cache on Rails 8.0.4: Rails.cache.fetch raises Arel::BindError #2797

@Chrisgo-75

Description

@Chrisgo-75

Steps to reproduce

Rails.cache.fetch("test-jwks-2", expires_in: 5.minutes) { { b: 2 } }

Raises:
wrong number of bind variables (1 for 0) in: "SELECT \"SOLID_CACHE_ENTRIES\".\"KEY\", \"SOLID_CACHE_ENTRIES\".\"VALUE\" FROM \"SOLID_CACHE_ENTRIES\" WHERE \"SOLID_CACHE_ENTRIES\".\"KEY_HASH\" IN (1111,2222)" (Arel::BindError)
Rails.cache.fetch("plain-test-2", expires_in: 5.minutes) { "world" }

Raises:
wrong number of bind variables (1 for 0) in: "SELECT \"SOLID_CACHE_ENTRIES\".\"KEY\", \"SOLID_CACHE_ENTRIES\".\"VALUE\" FROM \"SOLID_CACHE_ENTRIES\" WHERE \"SOLID_CACHE_ENTRIES\".\"KEY_HASH\" IN (1111,2222)" (Arel::BindError)

Below isn't an error in API but in testing in console it errored out too

Loading staging environment (Rails 8.0.4)
Rails.cache.write("plain-test", "hello", expires_in: 5.minutes)

Raises:
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter does not support upsert (ArgumentError)

          raise ArgumentError, "#{connection.class} does not support upsert"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I first noticed this while using Rails.cache.fetch in an OIDC JWKS lookup:

    def jwks
      Rails.cache.fetch(JWKS_CACHE_KEY, expires_in: 1.hour) do
        config_result = configuration
        return config_result unless config_result.ok?

        jwks_uri = config_result.value[:jwks_uri]
        unless jwks_uri.present?
          return ServiceResult.fail(
            ProblemDetails::Response.new(
              status: :bad_gateway,
              title: "OIDC JWKS URI missing",
              detail: "JWKS URI was not found in the OIDC discovery document.",
              type: "https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.3",
              upstream: "OIDC"
            )
          )
        end

        response = Faraday.get(jwks_uri)

        unless response.success?
          return ServiceResult.fail(
            ProblemDetails::Response.new(
              status: :bad_gateway,
              title: "OIDC JWKS fetch failed",
              detail: "JWKS endpoint returned HTTP #{response.status}.",
              type: "https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.3",
              upstream: "OIDC",
              upstream_status: response.status
            )
          )
        end

        parsed = JSON.parse(response.body).deep_symbolize_keys
        ServiceResult.ok(parsed)
      end # END Rails.cache.fetch
    end # END def jwks

System configuration

Ruby: 3.4.8-bookworm
Rails: 8.0.4
activerecord-oracle_enhanced-adapter: 8.0.0
ruby-oci8: 2.2.14
solid_cache: 1.0.10

Thank you,
Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions