Help Debugging NPM command in Remote Builder

I’m hoping someone here is more well versed in Docker or Node to help me figure out why this npm command is failing in the fly remote builder. The error seems almost useless

It’s trying to build my Rust WASM package using wasm-pack. wasm-pack is installed, the relevant build scripts look like this:

"build": "run-s build:*",
"postbuild": "run-s clean:*",
"build:browser": "wasm-pack build --target web --out-dir ./build/browser",
"clean:browser": "rimraf ./build/browser/package.json",
"build:node": "wasm-pack build --target nodejs --out-dir ./build/node",
"clean:node": "rimraf ./build/node/package.json"

The error I get in the Fly build logs looks like this:

22 3.041 webauthn-rs-client:build: ERROR: "build:browser" exited with 243.
#22 3.048 webauthn-rs-client:build: npm ERR! Lifecycle script `build` failed with error: 
#22 3.048 webauthn-rs-client:build: npm ERR! Error: command failed 
#22 3.048 webauthn-rs-client:build: npm ERR!   in workspace: webauthn-rs-client@0.0.1 
#22 3.048 webauthn-rs-client:build: npm ERR!   at location: /myapp/packages/webauthn_client 
#22 3.052 2022-07-22T02:40:09.416Z [ERROR] run.webauthn-rs-client:build: Error: command finished with error: %w: EXTRA_VALUE_AT_END="command (packages/webauthn_client) npm run build exited (1)"
#22 3.052 webauthn-rs-client:build: ERROR: command finished with error: command (packages/webauthn_client) npm run build exited (1)

The dockerfile looks like this:

FROM rust:1.62.1 as base

# set for base and all layer that inherit from it
ENV NODE_ENV production

# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl git 
RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
RUN bash /tmp/nodesource_setup.sh
RUN apt-get install nodejs

# Install all node_modules, including dev dependencies
FROM base as deps

WORKDIR /myapp

ADD package.json package-lock.json ./
RUN npm install --production=false


# Setup production node_modules
FROM base as production-deps

WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules
ADD package.json package-lock.json ./
RUN npm prune --production
RUN cargo install wasm-pack

# Build the app
FROM base as build

WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules

# ADD packages/panda5/prisma ./

ADD . .
RUN ls -lh .

RUN npx prisma generate --schema ./packages/panda5/prisma/schema.prisma

RUN chmod -R 755 /myapp
RUN ls -lh /myapp

RUN npm run build

# Finally, build the production image with minimal footprint
FROM base

WORKDIR /myapp

COPY --from=production-deps /myapp/node_modules /myapp/node_modules
COPY --from=build /myapp/node_modules/.prisma /myapp/node_modules/.prisma

COPY --from=build /myapp/build /myapp/build
COPY --from=build /myapp/public /myapp/public
ADD . .

CMD ["npm", "start"]

It runs flawlessly on my local machine, and with different weird errors if I try to build it on my M1 Mac. Anyone have any ideas on how I can investigate the error or access a more useful error message?