-
Notifications
You must be signed in to change notification settings - Fork 342
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
the imports are not properly generated for customFetch
which fail running in docker environment
#5297
Comments
customFetch
which causing running in docker environment customFetch
which fail running in docker environment
Could you create a reproduction repo? Thanks! |
Dockerfile FROM node:19-alpine as runtime
# install pnpm
RUN corepack enable; corepack prepare pnpm@8.1.0 --activate
WORKDIR /app
# clean install dependencies, no devDependencies, no prepare script
COPY .npmrc package.json pnpm-lock.yaml .meshrc.yml ./
RUN pnpm fetch --prod --unsafe-perm --ignore-scripts --unsafe-perm
RUN pnpm install -r --offline --prod
COPY . .
RUN pnpm build
RUN pnpm prune --prod --no-optional
############################################################
### stage_final
############################################################
FROM gcr.io/distroless/nodejs:18 as final
USER nonroot
ENV NODE_ENV production
WORKDIR /app
ENTRYPOINT ["/nodejs/bin/node"]
COPY --from=runtime --chown=nonroot:nonroot /app/.mesh ./.mesh
COPY --from=runtime --chown=nonroot:nonroot /app/config ./config
COPY --from=runtime --chown=nonroot:nonroot /app/src ./src
COPY --from=runtime --chown=nonroot:nonroot /app/tsconfig.json ./tsconfig.json
COPY --from=runtime --chown=nonroot:nonroot /app/package.json ./package.json
COPY --from=runtime --chown=nonroot:nonroot /app/node_modules ./node_modules
ENV PORT 4000
EXPOSE 4000
CMD ["node_modules/@graphql-mesh/cli/cjs/bin.js", "start"] tsconfig.json
|
Could you create a repo so we can run and reproduce? |
@ardatan sorry for the delay. here is the repo to reproduce this issue To reproduce error, run: git clone https://github.com/xmlking/graphql-mesh-specific
cd graphql-mesh-specific
pnpm i
pnpm build
pnpm start Error
This should work without error pnpm dev |
I debugged this a bit and the issue is basically here: which then calls: A very hacky fix:
I don't have time to dedicate to finding all the ways this (or a better fix) could break things (i.e. a proper solution). For now, I'll likely sed my way out of this but maybe this helps someone more knowleadgeable to fix this quicker. Btw this doesn't only affect docker environments. This happens calling |
I am using
customFetch
andadditionalEnvelopPlugins
with scripts pointing in mysrc
as shown below.everything works fine locally, but when I am doing docker build, I am getting import path error for
customFetch
This works in local run i.e,
npm run dev
but when dockerized and run, it is failing with path issues forcustomFetch
Workaround: I have to use this during docker build to make it work. (obviously not going to work for local run)
Note:
additionalEnvelopPlugins
has no issues.I think the root cause is how imports are generated in
.mesh/index.ts
The text was updated successfully, but these errors were encountered: