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

Error with next build: Legacy octal escape is not permitted in strict mode #8

Open
tom-sherman opened this issue May 27, 2023 · 10 comments

Comments

@tom-sherman
Copy link

tom-sherman commented May 27, 2023

Description

When trying to use this package with latest Next.js, I get a build failure using next build

Steps to reproduce

  1. pnpm create next-app my-app
  2. Follow the instructions here: https://vercel.com/docs/concepts/observability/otel-overview/quickstart#-install-an-otel-integration-to-visualize-traces
  3. pnpm run build

Expected:

Should build

Actual:

Throws Legacy octal escape is not permitted in strict mode.

./node_modules/.pnpm/ansi-color@0.2.1/node_modules/ansi-color/lib/ansi-color.js
Error: 
  × Legacy octal escape is not permitted in strict mode
    ╭─[/Users/tom.sherman/code/next-app-dir-tracing/node_modules/.pnpm/ansi-color@0.2.1/node_modules/ansi-color/lib/ansi-color.js:32:1]
 32 │   var color_attrs = color.split("+");
 33 │   var ansi_str = "";
 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;
    ╰────

  × Legacy octal escape is not permitted in strict mode
    ╭─[/Users/tom.sherman/code/next-app-dir-tracing/node_modules/.pnpm/ansi-color@0.2.1/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 │ };
    ╰────

Caused by:
    Syntax Error

Import trace for requested module:
./node_modules/.pnpm/ansi-color@0.2.1/node_modules/ansi-color/lib/ansi-color.js
./node_modules/.pnpm/bufrw@1.3.0/node_modules/bufrw/annotated_buffer.js
./node_modules/.pnpm/bufrw@1.3.0/node_modules/bufrw/interface.js
./node_modules/.pnpm/bufrw@1.3.0/node_modules/bufrw/index.js
./node_modules/.pnpm/thriftrw@3.12.0/node_modules/thriftrw/index.js
./node_modules/.pnpm/jaeger-client@3.19.0/node_modules/jaeger-client/dist/src/reporters/udp_sender.js
./node_modules/.pnpm/@opentelemetry+exporter-jaeger@1.12.0_@opentelemetry+api@1.4.1/node_modules/@opentelemetry/exporter-jaeger/build/src/types.js
./node_modules/.pnpm/@opentelemetry+exporter-jaeger@1.12.0_@opentelemetry+api@1.4.1/node_modules/@opentelemetry/exporter-jaeger/build/src/jaeger.js
./node_modules/.pnpm/@opentelemetry+exporter-jaeger@1.12.0_@opentelemetry+api@1.4.1/node_modules/@opentelemetry/exporter-jaeger/build/src/index.js
./node_modules/.pnpm/@opentelemetry+sdk-node@0.38.0_@opentelemetry+api@1.4.1/node_modules/@opentelemetry/sdk-node/build/src/TracerProviderWithEnvExporter.js
./node_modules/.pnpm/@opentelemetry+sdk-node@0.38.0_@opentelemetry+api@1.4.1/node_modules/@opentelemetry/sdk-node/build/src/sdk.js
./node_modules/.pnpm/@opentelemetry+sdk-node@0.38.0_@opentelemetry+api@1.4.1/node_modules/@opentelemetry/sdk-node/build/src/index.js
./node_modules/.pnpm/@vercel+otel@0.3.0/node_modules/@vercel/otel/dist/index.node.js
./src/OTEL-initializer.ts.ts
./src/fetcher.ts
./src/app/page.tsx

Reproduction repo

https://github.com/tom-sherman/next-app-dir-tracing

Additional info

vercel/otel version: 0.3.0
@opentelemetry/api: 1.4.1

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.13.0
      npm: 8.13.2
      Yarn: 1.22.19
      pnpm: 8.2.0
    Relevant packages:
      next: 13.4.4
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4
@tom-sherman
Copy link
Author

tom-sherman commented May 27, 2023

This is an interesting related issue: open-telemetry/opentelemetry-js#3759

It suggests that if you don't use the jaeger-exporter then this error should go away by upgrading to 0.39 of the OTEL Node SDK. However I tried doing this using pnpm overrides and it doesn't change anything.

See this commit on my reproduction: tom-sherman/next-app-dir-tracing@bf1076b

@davidalpert
Copy link

this is a blocking issue; if I can't build this I can't use it.

@ucheNkadiCode
Copy link

Thank you for this feedback @tom-sherman, I saw a few of your tweets as well. Is this the key error preventing you from using Vercel OTEL?

Are you aiming to use OTEL with a specific Observability provider? Or were you creating a custom log drain?

@tom-sherman
Copy link
Author

@ucheNkadiCode Yep this is blocking us.

We use Datadog so ideally looking to use the Vercel integration, but I know this isn't implemented with them yet (I have raised a feature request with Datadog for this).

Without that official integration support I was then looking to setup my own log drain or integration into Datadog, but I'm blocked by this issue.

@david-alpert-nl
Copy link

I am trying to use this outside of vercel, running my nextjs app on an amazon ec2 instance with either the datadog-agent or an otelcol collector.

but none of the collection methods matter if I can't build the app with the otel dependencies due to this octal escape issue.

@david-alpert-nl
Copy link

we have worked around this issue by removing nextjs and implementing our own server

@tom-sherman
Copy link
Author

I tried the install steps again and it's now working on our app. Not sure what's changed though...

@murphpdx
Copy link

This is also blocking my installation. We are using the new relic vercel integration.

@ucheNkadiCode
Copy link

@murphpdx and @tom-sherman I’ll get our team to take a look. I’ll circle back once we’re able to do an investigation

@murphpdx
Copy link

@murphpdx and @tom-sherman I’ll get our team to take a look. I’ll circle back once we’re able to do an investigation

Has there been any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants