Skip to content

JSON-RPC adapter issues #153

Description

@jg-rp

Early (maybe too early) testing of a JSON-RPC adapter for Python shows every spec failing with:

Error:    TypeError: DropProxy.wrap: cannot transport Liquid::Spec::LazySpec::SimpleFileSystem

before ever sending a render request. It looks like Liquid::Spec::JsonRpc#render's environment argument is receiving something other than variables with which to render the template.

If I temporarily skip environment wrapping by replacing wrapped_env = DropProxy.wrap(environment, @subprocess.drop_registry) with wrapped_env = environment, every spec fails with:

Error:    NoMethodError: undefined method '[]' for nil

before ever sending a render request. In this case Liquid::Spec::JsonRpc#serialize_render_options is expecting a hash but receiving nil.

Hacking past that by passing options || {} to serialize_render_options and inspecting my JSON-RPC server logs shows unexpected parameters for the render method. For example:

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "render",
  "params": {
    "template_id": {},
    "environment": {
      "registers": { "file_system": {} },
      "strict_errors": true
    },
    "options": { "strict_errors": false },
    "frozen_time": "2024-01-01T00:01:58Z"
  }
}

and

{
  "jsonrpc": "2.0",
  "id": 21,
  "method": "render",
  "params": {
    "template_id": { "v": null },
    "environment": {
      "registers": {
        "file_system": "#<Liquid::Spec::LazySpec::SimpleFileSystem:0x00007f6a84823fe8>"
      },
      "strict_errors": true
    },
    "options": {},
    "frozen_time": "2024-01-01T00:01:58Z"
  }
}

Every template_id is an object where I was expecting a string value. And environment does indeed contain things that don't look right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions