Sentry Example Page hydration error on Next 14

Đang mở
#1,066 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
nextjs, react, typescript

Hướng nghiên cứu

Tái hiện vấn đề với starter của Next.js 14, Sentry Wizard và Sentry Example Page, bắt đầu từ src/layout.tsx và route /sentry-example-page. Chạy yarn dev và xác minh rằng trang không còn báo lỗi React hydration hoặc văn bản server/client không khớp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Environment
"dependencies": {
    "@sentry/nextjs": "^10.4.0",
    "next": "14.2.5",
    "react": "^18",
    "react-dom": "^18"
}
Steps to Reproduce
  1. Create a new nextjs starter project npx create-next-app@14
  2. Run the Sentry Wizard npx @sentry/wizard@latest -i nextjs --saas
  3. Add export function generateMetadata(): Metadata { as instructed to src/layout.tsx
  4. Let the wizard add a Sentry Example Page
  5. Start the dev server yarn dev
  6. Navigate to http://localhost:3000/sentry-example-page
Expected Result

Page renders without errors.

Actual Result

Page renders with an error bubble:

Error: Text content does not match server-rendered HTML. See more info here: https://nextjs.org/docs/messages/react-hydration-error

Image

Text content did not match. Server: "
main {
display: flex;
min-height: 100vh;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 16px;
padding: 16px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

    h1 {
      padding: 0px 4px;
      border-radius: 4px;
      background-color: rgba(24, 20, 35, 0.03);
      font-family: monospace;
      font-size: 20px;
      line-height: 1.2;
    }

    p {
      margin: 0;
      font-size: 20px;
    }

    a {
      color: #6341F0;
      text-decoration: underline;
      cursor: pointer;

      @media (prefers-color-scheme: dark) {
        color: #B3A1FF;
      }
    }

    button {
      border-radius: 8px;
      color: white;
      cursor: pointer;
      background-color: #553DB8;
      border: none;
      padding: 0;
      margin-top: 4px;

      & > span {
        display: inline-block;
        padding: 12px 16px;
        border-radius: inherit;
        font-size: 20px;
        font-weight: bold;
        line-height: 1;
        background-color: #7553FF;
        border: 1px solid #553DB8;
        transform: translateY(-4px);
      }

      &:hover > span {
        transform: translateY(-8px);
      }

      &:active > span {
        transform: translateY(0);
      }

      &:disabled {
            cursor: not-allowed;
            opacity: 0.6;

            & > span {
              transform: translateY(0);
              border: none
            }
          }
    }

    .description {
      text-align: center;
      color: #6E6C75;
      max-width: 500px;
      line-height: 1.5;
      font-size: 20px;

      @media (prefers-color-scheme: dark) {
        color: #A49FB5;
      }
    }

    .flex-spacer {
      flex: 1;
    }

    .success {
      padding: 12px 16px;
      border-radius: 8px;
      font-size: 20px;
      line-height: 1;
      background-color: #00F261;
      border: 1px solid #00BF4D;
      color: #181423;
    }

    .success_placeholder {
      height: 46px;
    }

    .connectivity-error {
      padding: 12px 16px;
      background-color: #E50045;
      border-radius: 8px;
      width: 500px;
      color: #FFFFFF;
      border: 1px solid #A80033;
      text-align: center;
      margin: 0;
    }
    
    .connectivity-error a {
      color: #FFFFFF;
      text-decoration: underline;
    }
  " Client: "
    main {
      display: flex;
      min-height: 100vh;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 16px;
      padding: 16px;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    }

    h1 {
      padding: 0px 4px;
      border-radius: 4px;
      background-color: rgba(24, 20, 35, 0.03);
      font-family: monospace;
      font-size: 20px;
      line-height: 1.2;
    }

    p {
      margin: 0;
      font-size: 20px;
    }

    a {
      color: #6341F0;
      text-decoration: underline;
      cursor: pointer;

      @media (prefers-color-scheme: dark) {
        color: #B3A1FF;
      }
    }

    button {
      border-radius: 8px;
      color: white;
      cursor: pointer;
      background-color: #553DB8;
      border: none;
      padding: 0;
      margin-top: 4px;

      & > span {
        display: inline-block;
        padding: 12px 16px;
        border-radius: inherit;
        font-size: 20px;
        font-weight: bold;
        line-height: 1;
        background-color: #7553FF;
        border: 1px solid #553DB8;
        transform: translateY(-4px);
      }

      &:hover > span {
        transform: translateY(-8px);
      }

      &:active > span {
        transform: translateY(0);
      }

      &:disabled {
            cursor: not-allowed;
            opacity: 0.6;

            & > span {
              transform: translateY(0);
              border: none
            }
          }
    }

    .description {
      text-align: center;
      color: #6E6C75;
      max-width: 500px;
      line-height: 1.5;
      font-size: 20px;

      @media (prefers-color-scheme: dark) {
        color: #A49FB5;
      }
    }

    .flex-spacer {
      flex: 1;
    }

    .success {
      padding: 12px 16px;
      border-radius: 8px;
      font-size: 20px;
      line-height: 1;
      background-color: #00F261;
      border: 1px solid #00BF4D;
      color: #181423;
    }

    .success_placeholder {
      height: 46px;
    }

    .connectivity-error {
      padding: 12px 16px;
      background-color: #E50045;
      border-radius: 8px;
      width: 500px;
      color: #FFFFFF;
      border: 1px solid #A80033;
      text-align: center;
      margin: 0;
    }
    
    .connectivity-error a {
      color: #FFFFFF;
      text-decoration: underline;
    }
  "
Ngôn ngữ chính
TypeScript
Star
297
Fork
88
Merge trung bình
5 giờ 29 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/sentry-wizard

Tất cả issue của getsentry/sentry-wizard

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.