Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Many-to-many update check failing with connect

Đang mở
#2,531 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
node.js, postgresql, typescript
Lĩnh vực
authorization, backend

Hướng nghiên cứu

Start from the linked reproduction (f8k8/ZenstackConnectPermissionIssue): npm install, then npm run start to hit the failure under the @@allow('read,update', auth() != null && parents?[id == auth().id]) policy. The nested connect is permission-checked as an update on the relation's participant model before the connection exists, so the policy cannot see it; trace where nested-write checks run for many-to-many relations. Done means create-with-connect succeeds and a re-read shows the linked parent.

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

Mô tả

Description and expected behavior
When trying to create and connect an object, in the same operation, which has the following policy:
@@allow('read,update', auth() != null && parents?[id == auth().id])

The create fails with a model not updatable error:
ORMError: many-to-many relation participant model "Child" not updatable

The read back should succeed though, as the parent would be connected as part of the operation:

const child = await authedClient.child.create({
    data: {
      name: "Child",
      parents: {
        connect: { id: userId },
      },
    },
  });

Environment:

  • ZenStack version: 3.5.2
  • Database type: Postgres / SQLite
  • Node.js version: 24.11.1
  • Package manager: npm

Additional context
There's a reproduction repo here: https://github.com/f8k8/ZenstackConnectPermissionIssue
Running npm install will install the dependencies and seed the database, then run npm run start to see the error.

Ngôn ngữ chính
TypeScript
Star
2.9k
Fork
157
Merge trung bình
4 ngày 5 giờ
Pull request đã merge (30 ngày)
22

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 zenstackhq/zenstack

Tất cả issue của zenstackhq/zenstack

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.