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

Next.js + Webpack incompatibility #928

Closed
2 of 4 tasks
luismiramirez opened this issue Jul 27, 2023 · 5 comments · Fixed by #964
Closed
2 of 4 tasks

Next.js + Webpack incompatibility #928

luismiramirez opened this issue Jul 27, 2023 · 5 comments · Fixed by #964
Assignees

Comments

@luismiramirez
Copy link
Member

luismiramirez commented Jul 27, 2023

Root report

This was discovered after a customer reported an error related to the extension.node binary file throwing an error when being read by Next.js's Webpack.

I was able to get through that error by using a third-party loader for webpack that allows you to get Node binary files into the bundle.

Here's how the updated Next.js app config looks after adding the dependency to the project:

module.exports = {
  webpack: (config, _options) => {
    config.module.rules.push({
      test: /\.node$/i,
      loader: "node-loader",
    })
    return config
  }
}

Actual issue

After fixing the extension binary file, the app server logged this:

  x Legacy octal escape is not permitted in strict mode
    ,-[/Users/luismiramirez/code/winston-logging/node_modules/ansi-color/lib/ansi-color.js:34:1]
 34 |   for(var i=0, attr; attr = color_attrs[i]; i++) {
 35 |     ansi_str += "\033[" + ANSI_CODES[attr] + "m";
 36 |   }
 37 |   ansi_str += str + "\033[" + ANSI_CODES["off"] + "m";
    :                      ^^
 38 |   return ansi_str;
 39 | };
    `----

This comes from a package called ansi-color, which is the end of a dependency tree that starts from the @opentelemetry/sdk-node, which is a dependency of our integration.

  • @opentelemetry/sdk-node
    • @opentelemetry/exporter-jaeger
      • jaeger-client
        • thriftrw
          • bufrw

Another user already reported this issue to the OpenTelemetry team at: open-telemetry/opentelemetry-js#3759. The OpenTelemetry team released a fix for this here: open-telemetry/opentelemetry-js#3739.

I updated our @opentelemetry/sdk-node dependency to the latest version with no success. Also found out that other users are in the same situation, so the issue still needs to be closed.

OpenTelemetry's team progress on the issue can be tracked here: open-telemetry/opentelemetry-js#3759.


ToDo

@unflxw
Copy link
Contributor

unflxw commented Sep 27, 2023

The next OpenTelemetry release (changelog) should remove the dependency on @opentelemetry/exporter-jaeger, nicely working around this whole problem for us.

There is a customer waiting on the fix that should be notified: Intercom link

@luismiramirez
Copy link
Member Author

Awesome! I'll keep an eye on this to upgrade the dependencies as soon as it's released.

@luismiramirez luismiramirez self-assigned this Oct 13, 2023
@unflxw
Copy link
Contributor

unflxw commented Oct 24, 2023

Update: something went wrong with that fix -- a further fix was added by @luismiramirez in this PR, and it has now been merged. So the next OpenTelemetry version should include the fix.

@unflxw
Copy link
Contributor

unflxw commented Nov 28, 2023

Update update: version 0.45.0 was released, which includes the fix. Let's update the dependencies to bring that in.

@unflxw unflxw assigned unflxw and unassigned luismiramirez Nov 28, 2023
@unflxw
Copy link
Contributor

unflxw commented Nov 28, 2023

We'll be bumping the dependency range on @opentelemetry/sdk-node in the next release to make sure no one runs into this issue going forward.

In the meantime, if you're affected by this issue, running npm update @opentelemetry/sdk-node should fix it.

unflxw added a commit that referenced this issue Nov 28, 2023
Update dependencies in our `package-lock.json` to newer versions.

Update the dependency bound for `@opentelemetry/sdk-node` to
`^0.45.0` to ensure it brings in the fix for #928.
unflxw added a commit that referenced this issue Nov 30, 2023
Update dependencies in our `package-lock.json` to newer versions.

Update the dependency bound for `@opentelemetry/sdk-node` to
`^0.45.0` to ensure it brings in the fix for #928.
unflxw added a commit that referenced this issue Nov 30, 2023
This ensures that the fix for #928 is present.
unflxw added a commit that referenced this issue Nov 30, 2023
This ensures that the fix for #928 is present.
unflxw added a commit that referenced this issue Nov 30, 2023
This ensures that the fix for #928 is present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants