Issues Integrating Diesel and Rocket in Rust Project: Dependency Conflicts and Errors

I’m building a web server using Rocket and Diesel in Rust. I’m trying to set up PostgreSQL database integration, but I’m facing issues with dependency conflicts and build errors that I can’t resolve despite multiple debugging attempts.

Environment:

  • Rust: 1.70.0
  • Cargo: 1.70.0
  • Operating System: Windows 10 x64
  • Rocket Version: 0.5.0-rc.3
  • Diesel Version: 2.1.0
  • PostgreSQL: 15

Cargo.toml:

[package]
name = "rocket_web_server"
version = "0.1.0"
edition = "2021"

[dependencies]
rocket = { version = "0.5.0-rc.3", features = ["json"] }
rocket_sync_db_pools = { version = "0.1.0-rc.3", features = ["diesel_postgres_pool"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
diesel = { version = "2.1.0", features = ["postgres"] }
dotenvy = "0.15"
uuid = { version = "1.2", features = ["serde", "v4"] }
chrono = { version = "0.4", features = ["serde"] }

[build-dependencies]
diesel_cli = { version = "2.1.0", features = ["postgres"] }

Issues:
I’m encountering build errors and runtime issues related to dependency conflicts. Here are the specific problems I’ve faced:

  1. Compilation Errors:

    • I receive various dependency-related errors, particularly around Diesel and Rocket compatibility.
    • The errors suggest issues with features or versions not aligning correctly.
  2. No Improvement After Cleaning Build:
    I tried running cargo clean and then rebuilding the project with cargo build, but the errors persist.

  3. Environment Variables:

    • The .env file is correctly set up with DATABASE_URL, and I’m confident the database configuration is correct.
  4. Diesel CLI Setup:

    • I installed Diesel CLI using the command: cargo install diesel_cli --no-default-features --features postgres, and it’s properly installed, but the issues continue.

Debugging Steps Taken:

  1. Dependency Version Alignment:

    • Ensured that both [dependencies] and [build-dependencies] sections use compatible versions of Diesel and its related features.
  2. Rebuild and Cache Cleaning:

    • Ran cargo clean followed by cargo build to clear any potential cache issues.
  3. Verified Diesel CLI Setup:

    • Reinstalled Diesel CLI to ensure proper installation and checked for any potential issues with the CLI version.
  4. Examined Dependency Features:

    • Reviewed the features being used in dependencies to ensure there’s no feature mismatch or missing features.

Despite these efforts, I’m still encountering the same errors. I would appreciate any guidance or insights from the community on resolving these issues. Could there be a deeper compatibility issue, or am I missing something critical in the setup?

I’m totally newbie to Rust programming and any help or suggestions would be greatly appreciated!


PS: Here is one error from the error log and I got 53 more errors like this. All errors highlighted SqlType

error[E0433]: failed to resolve: could not find `sqlite` in the crate root
   --> C:UsersKAVI.cargoregistrysrcindex.crates.io-6f17d22bba15001fdiesel-2.2.2srcsql_typesmod.rs:40:48
    |
40  | #[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
    |                                                ^^^^^^^ could not find `sqlite` in the crate root
    |

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật