Skip to content

Issue with dynamic image URLs in CAT items: "Execution halted" or "'params' must be a list" errors #389

@geles13

Description

@geles13

Hello Concerto Community,

I'm working on a Concerto test and my primary goal is to reliably display images within test items, particularly for users accessing the test from different devices or without admin privileges.

Initially, I noticed that hardcoded image URLs (e.g., src="/admin/file/download?...") would display correctly when I was logged in as an admin, but these images wouldn't load for other users or from different devices. This led me to understand the necessity of using concerto.file.getUrl() to generate proper, publicly accessible URLs for these images.

I'm now trying to implement this dynamic URL generation within a CAT, which is set up using an assessment node. My approach involves:

Utilizing the "Item Template Params Module" within the assessment node's configuration.
Linking this module (via its dropdown setting) to an external R Script node (named _eval).
The _eval R script is intended to use concerto.file.getUrl("path/to/image.png") to get the dynamic URL and then return this (and other parameters) in an R list.
The "Item Template Params Module" is documented to "Require ... return variables: params".
The item HTML (defined in a Flat Table) uses {{image_url}} to embed the image.
Ultimately, concerto.template.show() is called to render the items.
The Problem & Evolution:

As I've worked on this, I've encountered a couple of critical errors:

At one stage, I was receiving a specific R error: Error in concerto.template.show(templateId = settings$itemTemplate, html = settings$itemTemplateHtml, : 'params' must be a list! This indicated that the params variable reaching the template rendering function was not structured as an R list, possibly due to issues in how the _eval script was returning data or if an error occurred within it.

Currently, after many attempts to simplify the _eval R script, the test now results in a generic Test problem encountered. Execution halted. This error occurs even when the _eval script is reduced to an absolute minimum, simply creating and returning a static R list, for example:

R

Example of minimal _eval R script

minimal_params_list <- list()
minimal_params_list$test_message <- "This is a minimal static list."
minimal_params_list$image_url <- "dummy_image_name.png" # Static string, not even calling concerto.file.getUrl()
minimal_params_list # Return this list
The fact that a generic "Execution halted" occurs even with such a basic list-returning script suggests a more fundamental issue: the R script node itself might be failing to execute correctly, or its output (even if a valid list) is causing a critical failure when the "Item Template Params Module" tries to process it.

Attempts to resolve have included:

Various R code structures in the _eval script for returning the parameters.
Ensuring the item HTML is correctly set up to use {{image_url}}.
Confirming the linkage between the "Item Template Params Module" and the _eval script via the module's settings.
My Questions:

Given the generic "Execution halted" error with a minimal, static list-returning R script in _eval, what could be causing the R script execution to fail so fundamentally in the context of an assessment node / "Item Template Params Module" linkage?
What is the definitively expected structure of the R list that an R script (like _eval) should return so that the "Item Template Params Module" can correctly prepare the params variable (as a list) for the concerto.template.show() function?
Are there known issues or specific R environment configurations / permissions required for R scripts linked to modules within CAT/assessment nodes that might lead to these types of errors? (I am working on obtaining detailed R error messages from the Concerto server logs, as I understand these are crucial).
If concerto.file.getUrl() itself were to fail silently (e.g., return NULL or throw an error not caught), could this lead to the _eval script returning a value that subsequently causes the "'params' must be a list!" error in concerto.template.show?
I can provide more specific details about my Concerto setup (e.g., test flow, module configurations) if that would be helpful. Any insights or suggestions on how to diagnose and resolve this "Execution halted" error would be immensely helpful.

Thank you for your time and assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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