CosmWasm / optimizer

Dockerfile and script to deterministically produce the smallest possible Wasm for your Rust contract
Apache License 2.0
118 stars 57 forks source link

"missing field `workspace`" when running in docker #113

Closed xmichael446 closed 10 months ago

xmichael446 commented 1 year ago

I have a cosmwasm contract and I'm running the optimizer via docker like this in the contract directory:

docker run --rm -v "$(pwd)":/code   --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry -e RUST_BACKTRACE=full   cosmwasm/workspace-optimizer:0.12.6

And it gives the following error:

1.60.0-x86_64-unknown-linux-musl (default)
cargo 1.60.0 (d1fd9fe2c 2022-03-01)
Building artifacts in workspace ...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: ErrorInner { kind: Custom, line: None, col: 0, message: "missing field `workspace`", key: [] } }', src/main.rs:35:55

The contract code is here

CodexEmmzy commented 1 year ago

Facing the same issue similar to the issue above , and i have been struggling to overcome this issue. Please we need an urgent response to this situation.

webmaster128 commented 1 year ago

If you compile a single contract project instead of a workspace, use cosmwasm/rust-optimizer instead of cosmwasm/workspace-optimizer

CodexEmmzy commented 1 year ago

Thank you for your time and feedback. I stopped having that issue but another was introduced. Error: rust warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Try again; class=Net (12) error: failed to getcw-controllersas a dependency of packagecw4-group v1.1.0 (/code)`

Caused by: failed to load source for dependency cw-controllers

Caused by: Unable to update /packages/controllers

Caused by: failed to read /packages/controllers/Cargo.toml

Caused by: No such file or directory (os error 2) ` And i checked all the files and folder but they where in the right position. Your feedback will be appreciated again.

CodexEmmzy commented 1 year ago

Please I need a Feedback. How long does it take to get a reply.

maurolacy commented 1 year ago

Looks like network issues / wrong dependenciea sources maybe?

Do you know Google? It pretty good search engine is.

webmaster128 commented 10 months ago

In the next update 0.15.0, the two images will be unified. See https://github.com/CosmWasm/rust-optimizer/pull/143. With this change the original issue does not happen anymore since there is only one image that works for both single contract and workspace projects.