BoKKeR / RSS-to-Telegram-Bot

RSS to Telegram python script
http://t.me/rss_t_bot
GNU General Public License v3.0
247 stars 105 forks source link

/help doesn't work #33

Closed alfonder closed 1 year ago

alfonder commented 2 years ago

The bot answers to /help command: ERROR: Error: 400: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 543

alfonder commented 2 years ago

Why all old versions (1.xx) have been removed from DockerHub? The new versions are buggy and no chance left to roll back.

BoKKeR commented 2 years ago

I will push the old version to dockerhub later today. Can you post info about your setup so I can look into this issue?

alfonder commented 2 years ago

Yes, sure. It was a docker container, running the old (python) version of the bot. Docker-compose script used to run:

telerss:
  container_name: telerss
  environment:
    - DELAY=${TRSS_DELAY_S}
    - TOKEN=${TRSS_TOKEN}
    - CHATID=${TRSS_CHATID}
  volumes:
    - ${DATA_DIR}/telerss/config:/app/config
  restart: unless-stopped
  image: bokker/rss.to.telegram

When the new (2.x) docker image was released, Watchtower updated the image and restarted the container. After that all the bot functionality became broken. Below is the container log:

INFO: Old database exists:config/rss.db, backing it up as backup_python_rss.db
Error: near line 2: UNIQUE constraint failed: rss_copy.name
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "rss_bot_database.db" at "file:./../config/rss_bot_database.db"
Migration init marked as applied.
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "rss_bot_database.db" at "file:./../config/rss_bot_database.db"

Already in sync, no schema change or pending migration was found.

✔ Generated Prisma Client (3.11.0 | library) to ./node_modules/@prisma/client in
 146ms

┌─────────────────────────────────────────────────────────┐
│  Update available 3.11.0 -> 3.12.0                      │
│  Run the following to update                            │
│    npm i --save-dev prisma@latest                       │
│    npm i @prisma/client@latest                          │
└─────────────────────────────────────────────────────────┘
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "rss_bot_database.db" at "file:./../config/rss_bot_database.db"

1 migration found in prisma/migrations

No pending migrations to apply.
[Nest] 447  - 04/10/2022, 5:45:37 PM     LOG [NestFactory] Starting Nest application...
[Nest] 447  - 04/10/2022, 5:45:37 PM     LOG [InstanceLoader] TelegrafModule dependencies initialized +151ms
[Nest] 447  - 04/10/2022, 5:45:37 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +4ms
[Nest] 447  - 04/10/2022, 5:45:37 PM     LOG [InstanceLoader] CustomLoggerModule dependencies initialized +3ms
[Nest] 447  - 04/10/2022, 5:45:37 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +2ms
[Nest] 447  - 04/10/2022, 5:45:37 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +6ms
[Nest] 447  - 04/10/2022, 5:45:37 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 447  - 04/10/2022, 5:45:38 PM     LOG [InstanceLoader] TelegrafCoreModule dependencies initialized +237ms
[Nest] 447  - 04/10/2022, 5:45:38 PM     LOG [InstanceLoader] TelegramModule dependencies initialized +2ms
[Nest] 447  - 04/10/2022, 5:45:38 PM     LOG [InstanceLoader] RssModule dependencies initialized +1ms
[Nest] 447  - 04/10/2022, 5:45:38 PM     LOG [InstanceLoader] AppModule dependencies initialized +2ms
[Nest] 447  - 04/10/2022, 5:45:38 PM     LOG [NestApplication] Nest application successfully started +99ms
BoKKeR commented 2 years ago

I pushed the legacy image:docker pull bokker/rss.to.telegram:1.0.0

The migration failed because you have entries with the same name or link The new database requires all entries to have unique name and url.

You can find your old database in /app/config/backup_python_rss.db

It might benefit you to stay on the old version as the new bot only dumps the links, I have not looked into adding other metadata

alfonder commented 2 years ago

The migration failed because you have entries with the same name or link The new database requires all entries to have unique name and url.

I had only 1 subscription in that DB. Therefore double entries were possible only if the bot didn't really delete entry on un-subscribe.

Also the main question still remains: why /help command doesn't work (even if DB is empty).

BoKKeR commented 2 years ago

Can you try to remove your database and restart the container? As you had a failed migration the database is probably not setup

alfonder commented 2 years ago

@BoKKeR I've removed old DB and re-created the container. Creating new empty DB was successful. Nevertheless on /help command the bot answers:

ERROR: Error: 400: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 543

The migration failed because you have entries with the same name or link The new database requires all entries to have unique name and url.

I found the reason. The old 1.x bot did not update the DB entry when a new article arrives. Instead it did adding a new entry. Therefore the same rss link appeared in multiple entries.

BoKKeR commented 2 years ago

I think this is solved on the develop branch but since there are many changes like multichat support, and its highly experimental I advise to wait until I merge to master

there is also a hosted instance you can try out