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

[Bug]: deployment of extensions fails when run from non interactive cli #2941

Closed
2 tasks done
xoko14 opened this issue Oct 9, 2023 · 10 comments · Fixed by #2966
Closed
2 tasks done

[Bug]: deployment of extensions fails when run from non interactive cli #2941

xoko14 opened this issue Oct 9, 2023 · 10 comments · Fixed by #2966
Labels
Type: Bug Something isn't working

Comments

@xoko14
Copy link

xoko14 commented Oct 9, 2023

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Extension, Function, Other

Expected behavior

Deployment of functions should succeed when run from a non interactive shell.

Actual behavior

When deploying any number of functions, the cli runs javy --version as implemented on #2911. This causes the command to fail when run from docker even though the output from javy seems to be correct. This was not an issue before #2911. This also happens when all the functions are written in Rust even though Rust functions don't need javy.

Output example (this was run from a Dockerfile):

2023-10-09T08:04:33.5305368Z ##[error]#19 0.900 > deploy
2023-10-09T08:04:33.5306620Z ##[error]#19 0.900 > shopify app deploy -f
2023-10-09T08:04:33.5307846Z ##[error]#19 0.900 
2023-10-09T08:04:33.5309178Z ##[error]#19 4.436 ╭─ info ───────────────────────────────────────────────────────────────────────╮
2023-10-09T08:04:33.5310503Z ##[error]#19 4.436 │                                                                              │
2023-10-09T08:04:33.5311770Z ##[error]#19 4.436 │  Using .env:                                                                 │
2023-10-09T08:04:33.5313050Z ##[error]#19 4.436 │                                                                              │
2023-10-09T08:04:33.5314322Z ##[error]#19 4.436 │    • Org:          [REDACTED]                                                │
2023-10-09T08:04:33.5315671Z ##[error]#19 4.436 │    • App:          [REDACTED]                                                │
2023-10-09T08:04:33.5316927Z ##[error]#19 4.436 │                                                                              │
2023-10-09T08:04:33.5318273Z ##[error]#19 4.436 │   You can pass `--reset` to your command to reset your app configuration.    │
2023-10-09T08:04:33.5319565Z ##[error]#19 4.436 │                                                                              │
2023-10-09T08:04:33.5321515Z ##[error]#19 4.436 ╰──────────────────────────────────────────────────────────────────────────────╯
2023-10-09T08:04:33.5322797Z ##[error]#19 4.436 
2023-10-09T08:04:33.5324108Z ##[error]#19 4.468 ╭─ warning ────────────────────────────────────────────────────────────────────╮
2023-10-09T08:04:33.5325437Z ##[error]#19 4.468 │                                                                              │
2023-10-09T08:04:33.5327308Z ##[error]#19 4.468 │  `npm run deploy` now releases changes to users.                             │
2023-10-09T08:04:33.5328765Z ##[error]#19 4.468 │                                                                              │
2023-10-09T08:04:33.5330098Z ##[error]#19 4.468 │  All your extensions will be released to users, unless you add the           │
2023-10-09T08:04:33.5331426Z ##[error]#19 4.468 │  `--no-release` flag.                                                        │
2023-10-09T08:04:33.5332683Z ##[error]#19 4.468 │                                                                              │
2023-10-09T08:04:33.5333949Z ##[error]#19 4.468 │  Reference                                                                   │
2023-10-09T08:04:33.5335263Z ##[error]#19 4.468 │    • Simplified extension deployment [1]                                     │
2023-10-09T08:04:33.5336517Z ##[error]#19 4.468 │                                                                              │
2023-10-09T08:04:33.5337894Z ##[error]#19 4.468 ╰──────────────────────────────────────────────────────────────────────────────╯
2023-10-09T08:04:33.5339248Z ##[error]#19 4.468 [1] https://shopify.dev/docs/apps/deployment/simplified-deployment
2023-10-09T08:04:33.5340502Z ##[error]#19 4.468 
2023-10-09T08:04:33.5341685Z ##[error]#19 5.536 
2023-10-09T08:04:33.5342955Z ##[error]#19 5.536 Releasing a new app version as part of [REDACTED]
2023-10-09T08:04:33.5344184Z ##[error]#19 5.536 
2023-10-09T08:04:33.5345480Z ##[error]#19 7.463 ── external error ──────────────────────────────────────────────────────────────
2023-10-09T08:04:33.5346716Z ##[error]#19 7.463 
2023-10-09T08:04:33.5347974Z ##[error]#19 7.463 Error coming from `npm exec -- javy --version`
2023-10-09T08:04:33.5349225Z ##[error]#19 7.463 
2023-10-09T08:04:33.5350559Z ##[error]#19 7.463 Command failed with exit code 1: npm exec -- javy --version
2023-10-09T08:04:33.5351817Z ##[error]#19 7.463 javy 1.2.0
2023-10-09T08:04:33.5353090Z ##[error]#19 7.463 JavaScript to WebAssembly toolchain
2023-10-09T08:04:33.5354355Z ##[error]#19 7.463 
2023-10-09T08:04:33.5355549Z ##[error]#19 7.463 USAGE:
2023-10-09T08:04:33.5356776Z ##[error]#19 7.463     javy <SUBCOMMAND>
2023-10-09T08:04:33.5357981Z ##[error]#19 7.463 
2023-10-09T08:04:33.5359188Z ##[error]#19 7.463 FLAGS:
2023-10-09T08:04:33.5361776Z ##[error]#19 7.463     -h, --help       Prints help information
2023-10-09T08:04:33.5364081Z ##[error]#19 7.463     -V, --version    Prints version information
2023-10-09T08:04:33.5365414Z ##[error]#19 7.463 
2023-10-09T08:04:33.5366681Z ##[error]#19 7.463 SUBCOMMANDS:
2023-10-09T08:04:33.5519068Z ##[error]#19 7.463     compile          Compiles JavaScript to WebAssembly
2023-10-09T08:04:33.5520882Z ##[error]#19 7.463     emit-provider    Emits the provider binary that is required to run
2023-10-09T08:04:33.5522226Z ##[error]#19 7.463 dynamically linked WebAssembly modules
2023-10-09T08:04:33.5523561Z ##[error]#19 7.463     help             Prints this message or the help of the given subcommand(s)
2023-10-09T08:04:33.5524957Z ##[error]#19 7.463 Downloading javy v1.2.0 to /root/.cache/binarycache/javy-v1.2.0
2023-10-09T08:04:33.5526205Z ##[error]#19 7.463 
2023-10-09T08:04:33.5527490Z ##[error]#19 7.463 ────────────────────────────────────────────────────────────────────────────────
2023-10-09T08:04:33.5528729Z ##[error]#19 7.463 
2023-10-09T08:04:33.5530062Z ##[error]#19 ERROR: process "/bin/sh -c npm run deploy -- -f" did not complete successfully: exit code: 1

Reproduction steps

  1. Try to deploy any number of functions from a non interactive shell that has not downloaded javy before (for example a Dockerfile).
  2. The deploy command returns code 1 after running javy --version

Operating System

Ubuntu 20.04

Shopify CLI version (check your project's package.json if you're not sure)

3.49.6

Shell

bash, nushell

Node version (run node -v if you're not sure)

v18.17.1

What language and version are you using in your application?

Node 18.17.1, Rust 1.72.0

@xoko14 xoko14 added the Type: Bug Something isn't working label Oct 9, 2023
@alvaro-shopify
Copy link
Contributor

Hey @xoko14 👋 !. Thanks for rising up this issue. I have not been able to reproduce this. Here it's a sample Dockerfile I have used to test the scenario using an app (only for extensions) that includes 3 product_discounts functions in JS.

FROM node:18

# Create app directory
WORKDIR /usr/src/app

COPY . .

ARG SHOPIFY_CLI_PARTNERS_TOKEN=[REDACTED]
ARG SHOPIFY_API_KEY=[REDACTED]
ARG SHOPIFY_PRODUCT_DISCOUNT_ID=[REDACTED]
ARG SHOPIFY_PRODUCT_DISCOUNT2_ID=[REDACTED]
ENV TIMEOUT=100

RUN npm run shopify app deploy -- -f && sleep $TIMEOUT```

could you give me more details about your Docker config?. Thanks in advance

@alvaro-shopify
Copy link
Contributor

This also happens when all the functions are written in Rust even though Rust functions don't need javy.

Regarding this, we'll create a fix. Sorry for inconveniences

@xoko14
Copy link
Author

xoko14 commented Oct 10, 2023

I'm experiencing this issue with this dockerfile. I removed lines related to configuring SSH. This Docker image gets built from an Azure Pipeline.

FROM node:18-alpine

ARG cli_token

EXPOSE 3000 2222
WORKDIR /app
COPY . .

ENV SHOPIFY_CLI_PARTNERS_TOKEN=$cli_token

RUN apk add --no-cache curl

RUN apk add --no-cache rust-wasm cargo
RUN cargo install cargo-wasi

RUN apk add --no-cache ruby-dev make gcompat
RUN gem install bundler

RUN npm install
RUN npm run build
RUN npm run deploy -- -f

CMD npx prisma migrate deploy; npm run start

@alvaro-shopify
Copy link
Contributor

hey @xoko14 , could you try removing the line RUN npm run build ?, this should be done with the deploy command.

@xoko14
Copy link
Author

xoko14 commented Oct 11, 2023

I can try to delete it, but I think it's needed to build the remix web app so that npm run start can actually start the compiled js files.

@alvaro-shopify
Copy link
Contributor

@xoko14, you are right I missed the line CMD npx prisma migrate deploy; npm run start you are right, in that case you need it. However I want to verify which could be the source of the problem.
Could you leave the docker file as simple as possible to test only the deploy of the JS functions?, it should look quite similar to mine. The app should only include JS functions extensions

@xoko14
Copy link
Author

xoko14 commented Oct 11, 2023

Sorry, maybe I wasn't clear enough in the first post. The project I'm having trouble with only has Rust functions.

@gonzaloriestra
Copy link
Contributor

This should be fixed in the next release. In the meanwhile, it should work if you use the version 3.49.5.

@isaacroldan
Copy link
Contributor

This should be fixed on version 3.50, closing the issue now :)

@Kashuab
Copy link

Kashuab commented Feb 29, 2024

I'm seeing this issue come back up.

Here's my Dockerfile:

FROM node:20.11.1-alpine3.19

ENV BUILD_DEPS="bash curl curl-dev tar wget linux-headers python3" \
    DEV_DEPS="libc6-compat gcompat build-base"

RUN apk add --update --upgrade $BUILD_DEPS $DEV_DEPS

# Create app directory
WORKDIR /app

COPY . .

If you run the container and do:

npm install
npm run deploy -- --force --config <your config if applicable>

It fails with a similar error:

...
Releasing a new app version as part of Strike Discount [Staging]
── external error ──────────────────────────────────────────────────────────────
Error coming from `npm exec -- javy --version`
Command failed with exit code 1: npm exec -- javy --version
Downloading javy v1.4.0 to /root/.cache/binarycache/javy-v1.4.0
────────────────────────────────────────────────────────────────────────────────

Here are my module versions:

    "@shopify/app": "3.56.1",
    "@shopify/cli": "3.56.1",

When I try to run npx javy --version I get the following error:

06a4861cd4cb:/app# npx javy --version

Downloading javy v1.4.0 to /root/.cache/binarycache/javy-v1.4.0
thread 'main' panicked at library/alloc/src/raw_vec.rs:545:5:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

In my case our functions are written in TypeScript.


Update: This is probably a Javy issue. Fixed by just using node:20.11.1-slim instead of the alpine version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants