LukeMathWalker / LukeMathWalker/zero-to-production
sqlx offline issue
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.5k
- Forks
- 585
- PR merge metrics
- No merged PRs in 30d
Description
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...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing subscriptions.rs with sqlx-data.json and reproduce the offline build using the shown Dockerfile through cargo build --release --bin zero2prod. Check whether the recorded query data matches the failing INSERT; done means the Docker build completes with SQLX_OFFLINE=true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, postgresql, rust
- Domain
- build-system, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100