Dynmap-Forge/Fabric

Dynmap-Forge/Fabric

1M Downloads

External webserver: caught SyntaxError: Unexpected token '<'

smaartscz opened this issue · 25 comments

commented

Issue Description: I have external webserver(nginx running in docker) to have access to dynmap while server is offline. I keep running into error(multiple errors to be precise): "caught SyntaxError: Unexpected token '<'"
image

My dynmap is configured to use MySQL(v5.5) database so missing tiles/ should not be issue

  • Dynmap Version: core=3.5-873, plugin=3.5-873
  • Server Version: Paper version git-Paper-538 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: bcd8dc2)
  • Pastebin of Configuration.txt: https://pastebin.com/nQdBxNwT
  • Server Host (if applicable): VPS with Pufferpanel for configuration
  • Server log: https://pastebin.com/as5xfCvQ
  • Steps to Replicate: Try to set up external webserver with nginx from this docker image: linuxserver/nginx:latest and use MariaDB: linuxserver/mariadb:arm32v7-latest, to have same setup try to use Pufferpanel(although it should not have any impact)
  • I have looked at all other issues and this is not a duplicate
  • I have been able to replicate this
commented

looks like some files didn't got uploaded correctly or sth,
did you follow this guide? https://github.com/webbukkit/dynmap/wiki/External-Webserver-Basics

commented

Yes I followed this guide. I also tried to copy files based on this guide

commented

you don't have a hostname specified in the config, also, the guide I sent is solely for filetree storage, the one you sent is the one needed for mysql storage, and then you also need to change the url part of dynmap in configuration, you probably need to follow the nginx part option 1

commented

Fixed that small mistake but it didn't have any impact on my issue. I sent this guide and try to follow it because it use mysql database as I want it.
Also if it helps internal web server works without issues(with mysql databse).

I tried multiple guides in this wiki but nothing worked(maybe they are outdated?)

commented

yeah, but to make the external webserver understand the mysql, you need to change the url part also, as is stated here

commented

This is my updated config: https://pastebin.com/u3DkNk73
Issue is not fixed.
image

commented

did you re-upload the web directory to the nginx folder? and restart nginx?

commented

AFAIK, when I specified webpath and this webpath is used by nginx it should be automatically updated, right?

commented

I don't know for sure whether dynmap uses that as its location for dumping the url file for nginx
the urls should be visible in the web/standalone/config.js file, if that is there, then it is using that folder.
next step would be to check the nginx error.log under /var/log/nginx/error.log by default

commented

What do you mean by url file for nginx?
There are no errors in error.log

commented

This is my config.js file: https://pastebin.com/HiFb3ipG

commented

to setup nginx to be able to use the mysql interfaces fefined in the standalone folder a config folder has to be set-up, its contents are the stuff you put in the url directive in configuration.
do you have a link to the map so I can check or is it still local only?

commented

Sure, have a look here

commented

there is something odd with your nginx config, look at the difference between the setup server's jquery.js: view-source:https://dynmap-setup.jurgenmk.nl/js/jquery-3.5.1.js?_=3.5-873 and yours: view-source:https://mc.smaarts.cz/smp/js/jquery-3.5.1.js?_=3.5-873 , (idk if this also works in other browsers, I use firefox)

commented

ah, now you should have some errors in the nginx logs if I remember correctly, probably something about php-mysqli and php-fpm
or that the mysql-configuration.php couldn't be loaded:
image

commented

Oh, I see now. There is probably issue with my reverse proxy, it keeps redirecting to puffepanel. Now we are moving somewhere! Check direct IP with port

commented

Yep, there are errors, looks like I need check php addons: https://pastebin.com/VekenBJ6

commented

no, addons are getting loaded, its complaining that there is no mysql_configuration.php

commented

Permissions should not be issue.

I will try to put ip instead of localhost.

Edit: I tried to set 777 permissions(I know its not safe) but it still doesn't work

commented

Hmmm, but it's inside folder
image

commented

does it have the proper permissions? (user:group stuff)
and does that file contain the credentials you set in the dynmap mysql config part?

commented

You are right, there are two containers - nginx and mariadb. I change localhost to vps ip and now it's working. Thank you for spending night with me and troubleshooting this mess.

It was dumb combination of misconfigured NPM and dumb mistake in docker networking.

commented

localhost will point to the docker's 127.0.0.1, the mysql is not on that docker's network I think?

commented

no worries, mistakes are easily made, glad it works! have fun with dynmap and have a nice rest of your evening!

commented

You are right but dumb mistakes are boring and they can be easily prevented.
Thank you and good night(if it's late in your country/have a nice rest of the day!