google-auth-library-nodejs icon indicating copy to clipboard operation
google-auth-library-nodejs copied to clipboard

refactor!: Circular dependencies - src/crypto/crypto.js and src/auth/pluggable-auth-client.js

Open nstuyvesant opened this issue 2 years ago • 3 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

  1. Is this a client library issue or a product issue? Client library

  2. Did someone already solve this? No

  3. Do you have a support contract? No

If the support paths suggested above still do not result in a resolution, please provide the following details.

Environment details

  • OS: macOS 13.3.1
  • Node.js version: 18.16.0
  • npm version: 9.6.4
  • google-auth-library version: 8.7.0

Steps to reproduce

  1. Examine the files listed below in sequence to see circular dependencies...
Circular dependency: node_modules/google-auth-library/build/src/crypto/crypto.js -> node_modules/google-auth-library/build/src/crypto/browser/crypto.js -> node_modules/google-auth-library/build/src/crypto/crypto.js
Circular dependency: node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js -> node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js -> node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js

nstuyvesant avatar Apr 16 '23 12:04 nstuyvesant

@nstuyvesant is this causing you some kind of error? It is unclear from the description.

ddelgrosso1 avatar Apr 17 '23 14:04 ddelgrosso1

Just getting warnings when I do a build.

nstuyvesant avatar Apr 17 '23 14:04 nstuyvesant

i am in a turborepo with docker. the problem is when im building locally, though it takes a lot of time if works. but in a docker container i have to be careful about the memory. for my project i think because of this circular dependancy. it keeps using more and more memory. i have teted this by allocating 8GB to the process and it still gets killed.

here is my out put when i run docker compose

1.209 • Packages in scope: svelte-manga
1.209 • Running build in 1 packages
1.209 • Remote caching disabled
1.209 svelte-manga:build: cache miss, executing c6424c443bb1c23f
1.422 svelte-manga:build: $ vite build
2.522 svelte-manga:build:
2.522 svelte-manga:build: vite v4.4.11 building SSR bundle for production...
2.558 svelte-manga:build: transforming...
3.909 svelte-manga:build:
3.909 svelte-manga:build: ╭── 🌼 daisyUI 3.9.2 https://daisyui.com
4.008 svelte-manga:build: │
4.008 svelte-manga:build: ├── 29 themes are enabled. How to add more themes:
4.008 svelte-manga:build: │   https://daisyui.com/docs/themes
4.008 svelte-manga:build: │
4.008 svelte-manga:build: ╰── ⭐️ Star daisyUI project on GitHub: https://github.com/saadeghi/daisyui
4.008 svelte-manga:build:
4.646 svelte-manga:build: ✓ 153 modules transformed.
4.659 svelte-manga:build: Generated an empty chunk: "entries/pages/manga/_page.ts".
4.708 svelte-manga:build: rendering chunks...
6.489 svelte-manga:build:
6.489 svelte-manga:build: vite v4.4.11 building for production...
6.495 svelte-manga:build: transforming...
8.690 svelte-manga:build: ✓ 194 modules transformed.
8.771 svelte-manga:build: rendering chunks...
8.844 svelte-manga:build: computing gzip size...
8.856 svelte-manga:build: .svelte-kit/output/client/_app/version.json                                        0.03 kB │ gzip:  0.05 kB
8.856 svelte-manga:build: .svelte-kit/output/client/.vite/manifest.json                                     13.53 kB │ gzip:  1.30 kB
...             
9.704 svelte-manga:build: .svelte-kit/output/server/entries/pages/contact/_page.svelte.js                                  10.33 kB
9.704 svelte-manga:build: .svelte-kit/output/server/entries/pages/dashboard/reading-progress/_page.svelte.js               13.04 kB
9.704 svelte-manga:build: .svelte-kit/output/server/entries/pages/manga/_id_/_page.svelte.js                               17.60 kB
9.704 svelte-manga:build: .svelte-kit/output/server/chunks/Icon.js                                                         47.07 kB
9.704 svelte-manga:build: .svelte-kit/output/server/index.js                                                               88.88 kB
9.704 svelte-manga:build:
9.704 svelte-manga:build: Run npm run preview to preview your production build locally.
9.707 svelte-manga:build:
9.707 svelte-manga:build: > Using @sveltejs/adapter-node
28.23 svelte-manga:build: Circular dependency: ../../node_modules/google-auth-library/build/src/crypto/crypto.js -> ../../node_modules/google-auth-library/build/src/crypto/browser/crypto.js -> ../../node_modules/google-auth-library/build/src/crypto/crypto.js
28.23 svelte-manga:build: Circular dependency: ../../node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js -> ../../node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js -> ../../node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js        
64.30 svelte-manga:build: Killed
64.48 svelte-manga:build: error Command failed with exit code 137.
64.48 svelte-manga:build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
64.69 svelte-manga:build: ERROR: command finished with error: command (/app/apps/svelte-manga) yarn run build exited (137)
64.69 svelte-manga#build: command (/app/apps/svelte-manga) yarn run build exited (137)
64.69
64.69  Tasks:    0 successful, 1 total
64.69 Cached:    0 cached, 1 total
64.69   Time:    1m4.217s
64.69 Failed:    svelte-manga#build
64.69
64.70  ERROR  run failed: command  exited (137)
65.02 error Command failed with exit code 137.
65.02 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
failed to solve: process "/bin/sh -c NODE_OPTIONS=\"--max-old-space-size=8192\" yarn turbo run build --filter=svelte-manga --concurrency 2" did not complete successfully: exit code: 137

This is the dockerfile responsible:

FROM node:18-alpine AS base

# This Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker.
# Make sure you update both files!

FROM base AS builder
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune svelte-manga --docker

# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app

# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install

# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json

# Uncomment and use build args to enable remote caching
# ARG TURBO_TEAM
# ENV TURBO_TEAM=$TURBO_TEAM

# ARG TURBO_TOKEN
# ENV TURBO_TOKEN=$TURBO_TOKEN


# You can adjust the memory limit based on your specific requirements.
RUN NODE_OPTIONS="--max-old-space-size=8192" yarn turbo run build --filter=svelte-manga --concurrency 2


# Create a new stage for the runner
FROM base AS runner
WORKDIR /app
# takes too much space. like 80% of the image
RUN yarn global add vite

# Don't run production as root - add a non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 svelte
USER svelte


# Copy the necessary files from the installer stage
COPY --from=installer /app/apps/svelte-manga/package.json .
COPY --from=installer /app/apps/svelte-manga/.svelte-kit .

EXPOSE 4173

# Modify this line to start your SvelteKit application, e.g., run your server.js or the appropriate script.
CMD [ "yarn", "preview", "--host" ]

valiantlynx avatar Oct 16 '23 19:10 valiantlynx