Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pages/aws/common_issues.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,39 @@ If you are refreshing a dynamic/static route or going to that route directly fro
This can also happen in app router when a client navigates via NextJS `<Link>` component.

The issue might be that your having a folder or file in your `public` directory with an overlapping between the name and your route. In this case, you should rename that to something else.


#### `cannot find module './chunks/xxxx.js'` error

Dynamic imports in `instrumentation.ts` will cause this error at runtime. Remove dynamic imports to resolve.

#### Sentry server side setup

The config recommended by Sentry docs uses dynamic imports in `instrumentation.ts`, which causes the above error.

Here's a working Sentry config which resolves the error:

`instrumentation.ts`
```typescript
import * as Sentry from '@sentry/nextjs';
import { initSentry } from '../sentry.server.config';

export const onRequestError = Sentry.captureRequestError;

export async function register() {
initSentry(process.env.NEXT_RUNTIME as 'nodejs' | 'edge');
}
```

`sentry.server.config.ts`
```typescript
import * as Sentry from '@sentry/nextjs';

export const initSentry = (runtime: 'nodejs' | 'edge') => {
Sentry.init({
dsn: 'https://...',

//...rest of your config
});
};
```
Loading