Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlx offline issue #260

Open
kuba-04 opened this issue May 28, 2024 · 2 comments
Open

sqlx offline issue #260

kuba-04 opened this issue May 28, 2024 · 2 comments

Comments

@kuba-04
Copy link

kuba-04 commented May 28, 2024

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...

@LukeMathWalker
Copy link
Owner

Can you share a repository with your project, so that I can have a look at it?

@kuba-04
Copy link
Author

kuba-04 commented May 28, 2024

sure, here it is: https://github.com/kuba-04/zero2prod
thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants