Skip to content
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

fix(app): made changes for deploying to vercel #614

Open
wants to merge 3 commits into
base: deploy/vercel
Choose a base branch
from

Conversation

semklim
Copy link

@semklim semklim commented Dec 22, 2024

Changes

  • Added dotenv for Vercel deployment configuration
  • Added ping-pong command functionality:
    • /ping command and text msg ping now respond with "pong"
  • Added Ukrainian (uk) localization with translations for all commands and messages
  • Createed [src/bot/handlers/commands/command-definitions.ts] to simplify adding new commands.
  • Updated [src/bot/handlers/commands/setcommands.ts]

Link to the working bot
@grammy_vercel_bot

how it work

@semklim semklim changed the title fix(app): make changes for deploying to vercel and add command ping-p… fix(app): made changes for deploying to vercel Dec 22, 2024
@semklim semklim mentioned this pull request Dec 23, 2024
@m0sviatoslav
Copy link

@semklim Hi, I used your commit to make it work, but get error in vercel logs. Not sure what's wrong here

Error: Invalid config
    at createConfigFromEnvironment (file:///var/task/build/src/config.js:62:15)
    at file:///var/task/build/src/config.js:67:16
    ... 2 lines matching cause stack trace ...
    at async d (/opt/rust/nodejs.js:16:18009) {
  [cause]: ValiError: Invalid type: Expected string but received undefined
      at Module.parse (file:///var/task/node_modules/valibot/dist/index.js:5219:11)
      at createConfig (file:///var/task/build/src/config.js:53:14)
      at createConfigFromEnvironment (file:///var/task/build/src/config.js:58:24)
      at file:///var/task/build/src/config.js:67:16
      at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
      at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
      at async d (/opt/rust/nodejs.js:16:18009) {
    issues: [ [Object] ]
  }
}
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.

@semklim
Copy link
Author

semklim commented Jan 24, 2025

[cause]: ValiError: Invalid type: Expected string but received undefined

I going to check localy your problem, but please check your .env file. I think you forgot to add the variable(s).

Here’s my .env file that worked on Vercel:
image

@semklim
Copy link
Author

semklim commented Jan 24, 2025

@m0sviatoslav

I allready try it on my local machine and all works.
Try this .env.

BOT_TOKEN=
BOT_MODE=polling
LOG_LEVEL=debug
DEBUG=true
BOT_WEBHOOK=https://www.example.com/webhook
BOT_WEBHOOK_SECRET="super-secret-key"
SERVER_HOST=localhost
SERVER_PORT=3000
BOT_ADMINS=[1]

@m0sviatoslav
Copy link

@semklim thank you!

@semklim
Copy link
Author

semklim commented Jan 24, 2025

@m0sviatoslav, I also found where the problem was. Problem with the vercel Sensitive flag. I am going to correct the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants