firebase / firebase/firebase-admin-node

[FR] Add check to verify if auth emulator host is valid

Đang mở
#2,881 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: auth type: feature request
Ngôn ngữ chính
TypeScript
Star
1.7k
Fork
419
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
16

Mô tả

**Is your feature request related to a problem? Please describe.**
I accidentally used `http://127.0.0.1:9099` instead of `127.0.0.1:9099` when setting `FIREBASE_AUTH_EMULATOR_HOST`.

Even though the emulator thew an error like below, it still took me a while to figure out what I did wrong 🤦 :
```
FirebaseAppError: Error while making request: getaddrinfo ENOTFOUND http. Error code: ENOTFOUND
at C:\Users\PATH\firebase-admin-node\lib\utils\api-request.js:268:19
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async main (file:///C:/Users/PATH/auth.js:12:5) {
errorInfo: {
code: 'app/network-error',
message: 'Error while making request: getaddrinfo ENOTFOUND http. Error code: ENOTFOUND'
},
codePrefix: 'app'
}
```

**Describe the solution you'd like**
Throw an error message indicating that `http` and `https` should not be included when setting `FIREBASE_AUTH_EMULATOR_HOST`. Found a similar logic in https://github.com/firebase/firebase-admin-node/blob/a46086b61f58f07426a6ca103e00385ae216691d/src/storage/storage.ts#L51-L56

**Describe alternatives you've considered**
N/A

**Additional context**
N/A

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tìm trong repository cách xử lý FIREBASE_AUTH_EMULATOR_HOST và so sánh với logic xác thực được liên kết trong src/storage/storage.ts. Xác nhận định dạng host ожида kiến và thêm chẩn đoán được yêu cầu cho các tiền tố http hoặc https, sau đó chạy các bài kiểm thử xác thực liên quan để xác minh rằng cài đặt không hợp lệ được báo cáo rõ ràng.

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

Đánh giá

Công nghệ
nodejs, typescript
Lĩnh vực
authentication, backend
Loại issue
Tính năng
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
50/100

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.