window.prodigy not available when run in Docker

Hello,

I "dockerized" my application with a custom recipe (also tried with a standard one). Where I run the prodigy command locally, in the browser's console I can access to window.prodigy and my custom javascript works fine. Unfortunately, when I launch the app via Docker, everything's work fine but the window.prodigy global var is not accessible anymore.

I can't find out why :confused:

Did someone face the same issue?

Thanks!

How are you defining your custom JavaScript? Are you using the prodigy.json or a custom recipe? window.prodigy is only available if custom JavaScript is enabled, i.e. if there's a "javascript" setting in your prodigy.json or recipe config.

If you were using the prodigy.json, maybe that file isn't available in your Docker container? By default, Prodigy will first check the user home directory and then the current working directory.

Hi Ines,

thank you for your answer.

The javascript is in the recipe config

return {
    'dataset': dataset,
    'view_id': 'html',
    'stream': stream,
    'update': update,
    'config': {
        "javascript": multiple_slider_js,
        "global_css": global_css
    },
}

(Yes, as you can see, javascript carousel are integrated in the app :slight_smile: and it looks good, in local at least)

The javascript is correctly imported, I can see the script tag in the HTML source code on the web service. The window.prodigy var is correctly accessible when I run outside of docker.

Thanks for the update! And that's strange – exposing the globals via window.prodigy happens entirely on the client, right before the <script> tag is added, so I don't see how the Docker setup would make any difference here :thinking:

So when you open the dockerized app in your browser and you type window.prodigy into the console, it's not accessible either? Is there any error in the console?

Thanks,

No error in the console and no window.prodigy

Actually the javascript and the global_css are not included in the dockerized version, even if I pass only the global_css like this

return {
    'dataset': dataset,
    'view_id': 'html',
    'stream': get_stream(),
    'update': update,
    'config': {
        "global_css": '.prodigy-content.c0172 {width: 100%}'
    },
}

Do you have a prodigy.json in your home directory or working directory that maybe overrides those? The idea behind this is that the recipe can define the defaults, and then you can override those in your global or local configuration if needed. So if your Docker container has a prodigy.json that sets something like "javascript": null, but your local installation doesn't, that could explain what's going on.

Totally right!

Thank you.

Locally the PRODIGY_HOME was not defined so the prodigy.json was not found and the global_css was not owerwritten but it was in Docker env with a global_css set to null.

1 Like