-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyntaxError: Unexpected reserved word #36
Comments
Hello. Can you please describe exact steps to reproduce the problem? |
Ok, an update. First I tried to do it on my desktop PC with Ubuntu 22.04 LTS and I got the error message described above. Now, I run "npm run build" in a virtual machine with the latest version of Ubuntu OS and this time it worked! I placed the contest of dist folder to the hosting provider web site and have set the menu button via @Botfather as you described. |
At this point, bot should have a button to launch the app, like the "Notes" button in @NotepherBot
On any NodeJS hosting you choose, it can be a serverless platform or your VPS server. Just upload the files and run |
Yes, this worked just fine. But it opens an empty page and I can't create any new notes there.
O, I see!.. the files from dist folder I uploaded to a normal hosting, just created a new folder on a web-site, where I have a wordpress installation. I will read more about VPS servers and check your link! Thank you and sorry for the naive questions. App building is not my cup of tea, unfortunately. Notes button should be totally enough for me... however something is still not right, or it does not look right to me, because I just get an empty page when I click Notes button. |
|
Well... yes. The ending of file names are different, but overall the structure is identical.
The code of the index.html also looks like yours:
However, when I click on the Notes button it gives me an empty page and once I add the bot to an existing chat then nothing happens. I repeated all steps one more time, creating another bot with BotFather and copy-pasted the link to the index.html, but it's the same outcome |
Hmm.. let me guess. Perhaps it is because of absolute paths, make this change to make paths relative and rebuild the web app |
Thanks for the help... but nothing changed! :(( I updated web-app/vite.config.ts, rebuild the app, copied the new files over ftp to the server.... the same. |
You can try to open the web app in https://web.telegram.org to see exactly what error occurs using browser devtools. |
Good idea! So, what it says is the following:
And below:
Also it says
In other words it seems to be related to the settings of WordPress. It seems that I need to google a bit more about it :)) |
Sadly, but I will probably give up... it seems to be too complex and I do know why things are not working. Briefly, I created Amazon AWS instance to host the app and all steps of your manual worked fine. However, most importantly I deployed the output resources to 3 different web-sites (always updating /setmenubutton command) and the bot still never worked for me in Telegram. I just get white empty page all the time after click on Notes button... so regardless of sucessfully running the app on Amazon AWS it does not seem to work at a more basic level for some weird reason :( |
Have they always been placed in a subfolder? |
Yes, but I also changed all paths in the index.html file from "/assets/" to "/notepher/assets/". Would it not be enough? I believe this is about that CSP policy. I also registered yesterday for a free hosting at Infinityfree.com and will try to place the app resources there once DNS servers will get updated. My assumption is that free resource might have different policies than paid web-hosting. |
An update: the web-app works perfectly on a free web hosting! but it does not work on my paid hosting :(( This feels to stupied, but at-least I know that the code is fine and I did not do anything wrong. The bot works now for me as web-app. I also have the bot running at amazon instance. I need to link it to the group chat so all my collegues would be able to access it. It's in production mode, I specified BOT_TOKEN and WEB_APP_URL Do you mind if I ask one more question? Could you please clarify and provide an example of what I have to specify for BOT_WEBHOOK? |
You must specify a URL pointing to running web server + bot token as the path. For example, if web server is running at https://example.org, you must specify Webhook can be quite tricky to setup, another option is to use polling mode (which doesn't require a web server, https and other stuff) with @grammyjs/runner plugin which makes polling mode suitable for production. I've prepared a branch with an example for you: Just set |
Ok... that's what I understood as well, but then it's not clear to me how telegram knows about where the bot is running. You said "This application is needed to make a bot respond to commands such as /start", but the only information I give to telegram is about web server https. The application can get the information from the web-server due to .env variables. How does the telegram chat or the web-server get the information from the app? Thanks a lot for the example with runner plugin! I can understand how the data communication works there. |
Yes, Telegram sends bot updates to web server address you specify (in
What information do you mean? I'm not sure I understand your question Just to clarify, the web application (located in |
Sorry, this is exactly what I find confusing because in step 4 you wrote "Set the WEB_APP_URL environment variable with the URL obtained during the web app deployment (step 2)", but then you say that web-app does not communicate in any way with the application. |
Hi, it's me again! I tried many options to create a fully functional bot and they all failed with different kind of errors... however I kind of like Netlify platform. If one day you will get bored and decided to be-friend you fantastic app with Netlify... Just let me know :) A short manual explaning the settings for deployment will be amazing. |
@akukalev check out my last issue, maybe it could help you |
Hello! I really love your app. I would like to add it to an existing Telegram chat to improve interactions between the members of a small team. So, I tried to follow your instructions, but I got a Syntax error while building the web app:
path/bla/bla/notepher-bot/web-app/node_modules/vite/bin/vite.js:7
await import('source-map-support').then((r) => r.default.install())
^^^^^
SyntaxError: Unexpected reserved word
Unfortunately, I do not have much skills with npm and java, I use python and would not be able to solve it. Can you please have a look? Thanks a lot!
The text was updated successfully, but these errors were encountered: