How to use predict() with xgboost package in a Shiny app online?

In my app.R file, my code for the prediction is:
predict(fit, test_set())

The fit object (.rds) is from the xgboost package.

At the very beginning of the app.R file, I put:
library(xgboost)

The app is working well on my local server.
But if I try to deploy it online, it's not working. I have the following warning in my logs:

Warning: Error in UseMethod: no applicable method for 'predict' applied to an object of class "c('_xgb.Booster', 'model_fit')"

Do you have some ideas to solve my issue?

Thank you in advance.

Posted here with solution

Yes, I posted the problem on stackoverflow. Then, today I answer to my own problem.