Unable to getting a working vnc block to work "BadAccess (attempt to access private resource denied)"

I am actually trying to use this project (GitHub - nucleardreamer/xserver-web-vnc: Run a web VNC client to interact with and view your local xserver) as an example, but all other attempts have been met with the same issue. vnc fails to start with the following error:

xserver-web-vnc  X11 MIT Shared Memory Attach failed:
 xserver-web-vnc    Is your DISPLAY=:0 on a remote machine?
 xserver-web-vnc    Suggestion, use: x11vnc -display :0 ... for local display :0
 xserver-web-vnc  
 xserver-web-vnc  caught X11 error:
 xserver-web-vnc  21/08/2021 02:46:26 deleted 60 tile_row polling images.
 xserver-web-vnc  X Error of failed request:  BadAccess (attempt to access private resource denied)
 xserver-web-vnc    Major opcode of failed request:  130 (MIT-SHM)
 xserver-web-vnc    Minor opcode of failed request:  1 (X_ShmAttach)
 xserver-web-vnc    Serial number of failed request:  56

This project is using the exact type of xerver implementation I am so if we can fix this one, then we can fix mine. I am hesitating to post mine right now because it is still in dev and a bit more messy and complicate. I will happily post more information as needed, but just wanted to get the ball rolling in case maybe someone knows the obvious reason why this does not work. Appreciate nay thoughts.

While doing a bunch of googling trying to resolve this issue I ran across this:

Still trying to wrap my head around it, but this may be relevant.

Hello @ropelletier87

could you please confirm what device type are you using? what balenaOS version do you have?

Let us know if you could fix this!

@mopus. Yes that would indeed be helpful information, I am sure. Ha. I am using an RPi 4B with 5.1.20 installed.

I have “fixed” this. I had to install vnc in the xserver block (Dockerfile) itself then running it from entry.sh. Really do not like this solution, as running vnc in its own block is far more elegant, but can’t find a solution to the problem above and been at it for hoooouuurs.