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

Circular dependency with 1.0.0-beta.9 #607

Closed
NinjaBanjo opened this issue Mar 30, 2022 · 7 comments
Closed

Circular dependency with 1.0.0-beta.9 #607

NinjaBanjo opened this issue Mar 30, 2022 · 7 comments
Labels

Comments

@NinjaBanjo
Copy link

Describe the bug
When consuming @datadog/[email protected] using rollup commonjs + node-resolve plugins a circular dependency is raised from the @datadog/datadog-api-client package. Replication steps to follow below

./node_modules/.bin/rollup -c rollup.config.js

index.js → dist/index.mjs...
(!) Circular dependencies
node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/http/http.js -> node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/http/isomorphic-fetch.js -> node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/http/http.js
node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/http/http.js -> node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/http/isomorphic-fetch.js -> /home/projects/nextjs-w4drlq/node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/http/http.js?commonjs-proxy -> node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/http/http.js
node_modules/@datadog/datadog-api-client/dist/index.js -> node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/index.js -> node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/apis/AWSIntegrationApi.js -> node_modules/@datadog/datadog-api-client/dist/packages/datadog-api-client-v1/models/ObjectSerializer.js -> node_modules/@datadog/datadog-api-client/dist/index.js
...and 12 more
created dist/index.mjs in 34.6s

To Reproduce
Steps to reproduce the behavior:

  1. open stackblitz https://stackblitz.com/edit/nextjs-w4drlq?file=rollup.config.js
  2. open a terminal in stackblitz linked above
  3. run npm install
  4. run ./node_modules/.bin/rollup -c rollup.config.js
  5. observe circular dependency in terminal after waiting for a few seconds to build

Expected behavior
Expect that rollup is able to complete a build with no circular dependency errors

Screenshots
N/A

Environment and Versions (please complete the following information):
A clear and precise description of your setup:

    "@datadog/datadog-api-client": "^1.0.0-beta.9",
    "@rollup/plugin-commonjs": "^21.0.3",
    "@rollup/plugin-node-resolve": "^13.1.3",
    "rollup": "^2.70.1"

Additional context
N/A

@therve
Copy link
Contributor

therve commented Mar 31, 2022

Hi,
Yeah that's because of the logger used in the serializer. Is that an issue in practice though, or just something detected by rollup?

@cholcombe973
Copy link

Hi therve,
I'm fairly certain this is a blocker for us deploying it to cloudflare. Without this dependency our code works fine and when I add it I get an error about the cloudflare worker crashing. I'm trying to dig into it more today

@therve
Copy link
Contributor

therve commented Mar 31, 2022

Isn't your project a react in-browser project? Because that won't work with datadog-api-client for now anyway.

@cholcombe973
Copy link

I don't think there's any react in the cloud flare workers code. Just typescript

@therve
Copy link
Contributor

therve commented Apr 1, 2022

Aren't those messages warnings not errors?

@cholcombe973
Copy link

Yeah it still builds even with the circular dependency warning but I'm unable to deploy to cloudflare workers after that. Just importing the datadog-api-client-tyepscript into the project and the require statement is enough to break it. I don't know 100% if this lib is the problem but without the import it works and with the import it fails to launch. The only data I have to go on is a warning about a bunch of circular dependencies.

@therve
Copy link
Contributor

therve commented Apr 5, 2022

Should be fixed in #616 , which will be in the next release. Thanks!

@therve therve closed this as completed Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants