Page MenuHomePhabricator

Error when running a clean wikibase-docker image: Config.getConfig is not a function
Closed, InvalidPublic


What is the problem

I have tried setting up an instance of the wikibase-docker container but I encountered a problem with the Wikidata Query Service GUI. In http://localhost:8282/ I get the following error message in my browser's console: CONFIG.getConfig is not a function.

Steps to reproduce it

I am trying to run the container on an Ubuntu virtual machine in VM VirtualBox inside a Windows 10 Host.

Windows version: 1809 (Build: 17763.503)
VM VirtualBox version:  6.0.8 r130520 (Qt5.6.2)y
Ubuntu version: Linux VirtualBox 4.15.0-45-generic #48-Ubuntu x86_64 x86_64 x86_64 GNU/Linux

what I have done:

git clone

# commit ID when cloned 57f4d1509375ace2cef6e2c73210f3934895fb75
# repository state when cloned

cd wikibase-docker/
docker-compose pull
docker-compose up

I wait until I see the messages:

Got no real changes
Sleeping for 10 secs

so I assume every thing is ready.

However, when I go to http://localhost:8282/, The icon in top left is not loaded and the items on the left side bar do not exist, and in the console I found the following error: CONFIG.getConfig is not a function.

Expected behaviour

A normal functioning page should appear just like the official Query Service Page

What is (possibly) causing the problem.

Note: Since this docker container is a composition of a lot of repos and other containers, all of the links in the coming sections are permalinks to Github at the specific state when I encountered the problem. I will also state the commit ID when possible. All of this happened on the 28/05/2019.

Please excuse some of the naivety in my approach, I am a beginner when it comes to docker.

Checking the file config.js reveals that the function itself does not exist.

After some digging, I found out that the docker image for this is wikibase/wdqs-frontend.

Checking the Dockerfile in wdqs-frontend reveals the following:

# ...
ADD ./

# Creates /wikidata-query-gui-master
RUN unzip && rm

# ...
COPY --from=fetcher /wikidata-query-gui-master /tmp/wikidata-query-gui-master

WORKDIR /tmp/wikidata-query-gui-master

# ...

COPY --from=builder /tmp/wikidata-query-gui-master /usr/share/nginx/html
RUN echo "" > style.css
COPY config.js /templates/config.js
COPY default.conf /templates/default.conf

So the code for the actual GUI is in the repo and it always downloads the most updated version of that repo.

However, the config file in the wikidata-query-gui repo does have the getConfig() method that is missing.
(commit for the link is 70ed8ec97f3aeb892dd99f5d9320232c41af95af)

So going back to the Dockerfile in wdqs-frontend, the last couple of lines do the following:

COPY config.js /templates/config.js

# ...


The script actually copies another config.js file from wdqs-frontend/latest.

This file does not have the getConfig() function and looks like an older version of the other (valid) config.js file in wikidata-query-gui.

The copying is done to /templates/config.js. However, in the file that is also copied, I found the following:

envsubst < /templates/config.js > /usr/share/nginx/html/wikibase/config.js

And when this script runs, it will override the valid config.js file with the invalid one.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
AbdBarho updated the task description. (Show Details)

I imagine the front-end code has been updated and now the docket image and example docker compose needs to be updated to follow.

This is one of the issue with not having releases of the wdqs-frontend or any way really to have image tags other than latest.

We could start pinning some arbritrary specific versions at the start of each month for example, which means people could use those instead of latest, and then they would have a stable ish upgrade path for the wdqs front-end docker images.
@lydia @alaa this is one example of a ticket that could go into a hike focusing on "docker images for production" type scope.

Our project site is also affected by this. Thanks for the details @AbdBarho.

@Jkbr In case it helps, we managed to work around the problem by cloning the wdqs-frontend repository and manually modifying the Dockerfile so that it does not override the config file.

You can see our code here

This however is about 2 months old, I hope it still works.

You might also face another problem in the GUI, which is deprecated functions being used by JQuery, but this only happens in latest versions of FireFox, we tested it out with Chrome and it worked fine.

Can you confirm that it is still happening on the latest version of the latest tag of the image?
Could you post the image hash and digest you are using?
And also anything you are modifying the image with at runtime (file mounts, env vars, etc)

Hi @Addshore I've been able to get our forked version working based on the latest version -- thanks.

We tripped over this migrating to a new instance as we put our project into maintenance mode, so I'm partly here to vote for a move to using versions.