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

Nextjs: No way to call "consumeError" #6692

Closed
Negan1911 opened this issue Sep 22, 2023 · 6 comments · Fixed by #6755
Closed

Nextjs: No way to call "consumeError" #6692

Negan1911 opened this issue Sep 22, 2023 · 6 comments · Fixed by #6755
Labels
external bug / request Bugs related to external customers, users, etc..

Comments

@Negan1911
Copy link

Negan1911 commented Sep 22, 2023

Describe the bug
I'm following the guide and trying to use the app router with serverActions, but looks like by default, our Server actions errors are not being tracked.

We also can't use consumeError to catch the errors since @highlight-run/next/server doesn't include it and @highlight-run/node fails when being imported on NextJs (because of ansi-color using Octal escape characters)

@Negan1911 Negan1911 added the external bug / request Bugs related to external customers, users, etc.. label Sep 22, 2023
@farhan787
Copy link

farhan787 commented Sep 23, 2023

@Negan1911 the octal escape character issue is happening because ansi-color is using old invalid octal character \033
but highlight is using its local fork and they've locally replaced it with valid escape character \x1B (you can see in local fork).

Some dependency in your next project might still be using ansi-color package and to fix it temporarily you can change the character there in path node_modules/ansi-color/lib/ansi-color.js. A fix PR has been opened in the original repo as well.

@perkinsjr
Copy link

Just to add some context. If you create a new app router project, this error occurs.

Steps to repo:

  1. npx-create-app@latest
  2. npm install @highlight-run/next
  3. Add the required highlight features and add a route handler for example
import { AppRouterHighlight } from '@highlight-run/next/server'


export const withAppRouterHighlight = AppRouterHighlight({
	projectID: "project_id",
})
import { NextRequest } from 'next/server'
import { withAppRouterHighlight } from '../../utils/app-router-highlight.config'

export const GET = withAppRouterHighlight(async function GET(request: NextRequest) {
	console.info('Highlighting route')

	if (Math.random() < 0.8) {
		return new Response('Success')
	} else {
		throw new Error('Error')
	}
})
  1. Error occurs.

The PR is almost 4 years old, so it unlikely that it will ever be merged at this point.

@farhan787
Copy link

farhan787 commented Sep 23, 2023

@perkinsjr I completely missed the PR date, my bad! Thanks for calling out.

@vhmartinezm
Copy link

Same error

Vadman97 pushed a commit that referenced this issue Sep 28, 2023
- Repairing the client import by publishing `client.d.ts`
- Repair `clean-dist.sh`
- Internalize `@highlight-run/sourcemap-uploader`
- Downgrade `@opentelemetry/api`


closes #6747 closes #6692
@deltaepsilon
Copy link
Contributor

@Negan1911 the octal escape character issue is happening because ansi-color is using old invalid octal character \033 but highlight is using its local fork and they've locally replaced it with valid escape character \x1B (you can see in local fork).

Some dependency in your next project might still be using ansi-color package and to fix it temporarily you can change the character there in path node_modules/ansi-color/lib/ansi-color.js. A fix PR has been opened in the original repo as well.

I figured out how to bundle the ansi-color patch into the bundle. It should just work now... if I can ever get these yarn publish bugs sorted out 😞

@deltaepsilon
Copy link
Contributor

I love OTEL, I really do. But I've had to patching OTEL and Protobuf a fair bit to get Vercel support rolling.

lewisl9029 pushed a commit to lewisl9029/highlight that referenced this issue Nov 16, 2023
- Repairing the client import by publishing `client.d.ts`
- Repair `clean-dist.sh`
- Internalize `@highlight-run/sourcemap-uploader`
- Downgrade `@opentelemetry/api`


closes highlight#6747 closes highlight#6692
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external bug / request Bugs related to external customers, users, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants