sqlx offline issue
I don't know if it is a good title, maybe it is not even a place to ask questions like this, but I am totally stuck and unable to move forward with this training. I am at 7.5.4.2, where we add new column status, so after doing this in subscriptions.rs something happens with the docker build, it fails no matter what I do in sqlx-data.json . Did anyone have this error while running docker build locally?
Step 11/18 : RUN cargo build --release --bin zero2prod
---> Running in ee2eb93349b4
Compiling zero2prod v0.1.0 (/app)
error: failed to find data for query INSERT INTO subscriptions (id, email, name, subscribed_at, status)
VALUES ($1, $2, $3, $4, 'confirmed')
here is sqlx-data.json:
{
"db": "PostgreSQL",
"bcfcfebc6f5e8ffbf97d97c5a209be78b46d703924482cf8b43842705fcb7714": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Uuid",
"Text",
"Text",
"Timestamptz",
"Text"
]
}
},
"query": "\n INSERT INTO subscriptions (id, email, name, subscribed_at, status)\n VALUES ($1, $2, $3, $4, $5)\n "
}
}
and dockerfile until this step:
FROM lukemathwalker/cargo-chef:latest-rust-1.77.2 as chef
WORKDIR /app
FROM chef as planner
COPY . .
# Compute a lock-like file for our project
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder
COPY --from=planner /app/recipe.json recipe.json
# Build our project dependencies, not our application!
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
ENV SQLX_OFFLINE true
# Build our project
RUN cargo build --release --bin zero2prod
error message suggests like if the query is not doing the same thing the code is doing. My code is exactly the same as in the book. Maybe this issue could be about adding what is necessary to this json file so other people won't get stuck as me here? Does anyone have any idea how to fix this, I will be very grateful, it's been too long...
Can you share a repository with your project, so that I can have a look at it?
sure, here it is: https://github.com/kuba-04/zero2prod thank you so much!