Graph API Timeout while validating endpoint on Azure / AWS

I have been struggling for the past couple of days with setting up a webhook for outlook via the Graph API of microsoft. Initially, I hosted my application locally and exposed it to the internet with ngrok. Connecting to the Graph API worked well. However, when I moved my application to the cloud. I noticed that each time I tried to setup the Graph API webhook for outlook, I received a timeout error. I checked my Azure endpoint with:

curl -X POST https://db.chainfill.bluewaterfall.nl/email-integration/emails?validationToken=someToken -H "Accept: text/plain" -v

and everything worked fine, yielding a 200 Ok response. I also tracked the incomming headers for my application on Azure. When I make a subscription request, the entire backend seems non responsive, as if the graph API request blocks the entire server.

Tim out error:

Starting new HTTPS connection (1): graph.microsoft.com:443 https://graph.microsoft.com:443 "POST /v1.0/subscriptions HTTP/1.1" 400 None Graph API Error: {'error': {'code': 'ValidationError', 'message': 'Subscription validation request timed out.', 'innerError': {'date': '2024-05-14T16:12:13', 'request-id': 'eb76a2e1-95c7-439c-aaca-6efaf031723d', 'client-request-id': 'eb76a2e1-95c7-439c-aaca-6efaf031723d'}}}

Right afte receiving the time out error:

Response for /email-integration/subscription with headers: {'Content-Type': 'application/json', 'Vary': 'Accept, origin', 'Allow': 'POST, OPTIONS', 'X-Frame-Options': 'DENY', 'Content-Length': '42', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin', 'Cross-Origin-Opener-Policy': 'same-origin'}
Response Status Code: 200 Response Content Type: application/json Incoming request at /email-integration/emails with headers: {'Host': 'db.chainfill.bluewaterfall.nl', 'X-Real-Ip': '137.135.11.116', 'X-Forwarded-For': '137.135.11.116', 'X-Forwarded-Proto': 'https', 'Connection': 'close', 'Content-Length': '0', 'Client-Request-Id': 'eb76a2e1-95c7-439c-aaca-6efaf031723d', 'Accept': 'text/plain', 'Content-Type': 'text/plain; charset=utf-8'}

Request Path: /email-integration/emails

Request Method: POST

Request Query Params: <QueryDict: {'validationToken': ['Validation: Testing client application reachability for subscription Request-Id: eb76a2e1-95c7-439c-aaca-6efaf031723d']}>

Accept Headers: text/plain Request URL: https://db.chainfill.bluewaterfall.nl/email-integration/emails?validationToken=Validation%3a+Testing+client+application+reachability+for+subscription+Request-Id%3a+eb76a2e1-95c7-439c-aaca-6efaf031723d

validation_token Validation: Testing client application reachability for subscription Request-Id: eb76a2e1-95c7-439c-aaca-6efaf031723d

Received validation token Response for /email-integration/emails with headers: {'Content-Type': 'text/plain', 'X-Frame-Options': 'DENY', 'Content-Length': '117', 'Vary': 'origin', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin', 'Cross-Origin-Opener-Policy': 'same-origin'}

Response Status Code: 200 Response Content Type: text/plain

This is the piece of the code that receives the validation post message from graph api:

Python

`@method_decorator(csrf_exempt, name=’dispatch’)
class GetMailsFromOutlookView(View):
“””Fetches an email from outlook when a new email is received”””
queryset = UserProfile.objects.all()
serializer_class = UserProfileSerializer

# Need to secure this route still

def post(self, request, *args, **kwargs):
    global last_processed
    debounce_period = 30
    try:
        logging.debug(f'Request URL: {request.build_absolute_uri()}')
        # Retrieve the validation token from the query parameters
        validation_token = request.GET.get('validationToken')
        logging.debug(f'validation_token {validation_token}')
        if validation_token:
            logging.debug('Received validation token')
            # Check the Accept header and adjust the content type of the response accordingly
            accept_header = request.headers.get('Accept', 'text/plain')  # Default to text/plain if not specified
            if 'text/plain' in accept_header:
                return HttpResponse(validation_token, content_type="text/plain", status=200)
            else:
                return HttpResponse("Unsupported media type", status=415)`

I have also tried hosting on aws, but the same problem arrised. The Vm that I’m running is: Standard B2ms (2 vcpus, 8 GiB memory). If somebody encountered a similar problem or knows some steps forward that I can take, it would be greatly appreciated. Thanks a lot!

Best regards,

Yorick

Tried:

  • Hosting on Azure
  • Hosting on AWS
  • Different endpoint configurations

Expected:

  • resolve the timeout error

New contributor

Bluewaterfall Solutions is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật