Plugin not loading and CSP issue, whatโ€™s missing? ...
# gooddata-cloud
r
Plugin not loading and CSP issue, whatโ€™s missing? Iโ€™m testing the process to build a custom plugin. I ran with the boilerplate tutorial (https://sdk.gooddata.com/gooddata-ui/docs/dashboard_plugins.html , https://www.gooddata.com/blog/gooddata-plugins-gauge-chart/ and the readme on github). The output of the linking seems all good:
Copy code
๐Ÿ›ˆ Reading .env and .env.secrets files.
๐Ÿ›ˆ Everything looks valid. Going to link plugin on the dashboard.
๐Ÿ›ˆ   Hostname    : <https://safe-bulldog.trial.cloud.gooddata.com>   (<http://GoodData.CN|GoodData.CN>)
๐Ÿ›ˆ   Workspace   : 2c2654a3fed743caacc58c138057a25f
๐Ÿ›ˆ   Dashboard   : 5809bccc-f891-4257-9ce2-0bb1edbf2efc
๐Ÿ›ˆ   Plugin obj  : e71ee4b1-f614-4d42-9116-6aa348e15372
โœ” Linked dashboard 5809bccc-f891-4257-9ce2-0bb1edbf2efc with plugin e71ee4b1-f614-4d42-9116-6aa348e15372.
The plugin file loads in a browser. But when I load the dashboard, no plugin, and the dev tools show a CSP error, though I added the s3 bucket url to
script-src
. Have I missed something?
m
Hi Romain, for the plugin to load, you need to define a CSP Directive according to Enable CSP for an Organization and CORS according to Enable CORS for an Organization.
r
it was already setup like this: And the code loads from: https://zz-fc-dev-goodata-plugins.s3.eu-north-1.amazonaws.com/dashboardPlugin/dp_dynamic_rich_text_plugin.mjs Am I doing something wrong on this trial account?
Found the origin of the pb. Could be useful for others. Itโ€™s on the s3 side of things and you need to set the CORS header there:
Copy code
[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "HEAD"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]