Skip to content

Forum in maintenance, we will back soon πŸ™‚

Hoisting in Heroko
 
Notifications
Clear all

Hoisting in Heroko

5 Posts
3 Users
0 Reactions
165 Views
(@thoufeeq87)
Posts: 6
Member Registered
Topic starter
 

HiΒ 
I have built an API that extracts Twitter data from Apify actor and then gives tweets as output.
I have used FastAPI to create api. The APi has worked successfully before hosting in heroku.

But once i hosted in heroku free version, i am getting timeout error
below is the log from heroku.

Kindly advise on how to resolve the timeout issue.

2024-05-28T14:58:53.067109+00:00 app[web.1]: INFO:     91.73.75.168:0 - "GET /cart.json HTTP/1.1" 404 Not Found
2024-05-28T14:58:53.067766+00:00 heroku[router]: at=info method=GET path="/cart.json" host=twitter-engagement-397330c3465e.herokuapp.com request_id=08daee41-7a42-4708-b96b-0f7b257d6240 fwd="91.73.75.168" dyno=web.1 connect=0ms service=1ms status=404 bytes=173 protocol=https
2024-05-28T14:58:55.751571+00:00 app[web.1]: INFO:     91.73.75.168:0 - "GET /docs HTTP/1.1" 200 OK
2024-05-28T14:58:55.752212+00:00 heroku[router]: at=info method=GET path="/docs" host=twitter-engagement-397330c3465e.herokuapp.com request_id=fdfadf5d-25f3-44cd-8189-24261228d0d2 fwd="91.73.75.168" dyno=web.1 connect=0ms service=1ms status=200 bytes=1092 protocol=https
2024-05-28T14:58:56.148115+00:00 app[web.1]: INFO:     91.73.75.168:0 - "GET /openapi.json HTTP/1.1" 200 OK
2024-05-28T14:58:56.148744+00:00 heroku[router]: at=info method=GET path="/openapi.json" host=twitter-engagement-397330c3465e.herokuapp.com request_id=d66af4c5-7e56-41f3-9ab7-bf80418652f1 fwd="91.73.75.168" dyno=web.1 connect=0ms service=2ms status=200 bytes=1300 protocol=https
2024-05-28T14:58:56.465024+00:00 app[web.1]: INFO:     91.73.75.168:0 - "GET /cart.json HTTP/1.1" 404 Not Found
2024-05-28T14:58:56.465607+00:00 heroku[router]: at=info method=GET path="/cart.json" host=twitter-engagement-397330c3465e.herokuapp.com request_id=b83f0c34-9826-48a6-879a-8781d7d51098 fwd="91.73.75.168" dyno=web.1 connect=0ms service=1ms status=404 bytes=173 protocol=https
2024-05-28T14:59:23.000000+00:00 app[heroku-redis]: source=REDIS addon=redis-concentric-90513 sample#active-connections=1 sample#load-avg-1m=5.455 sample#load-avg-5m=4.665 sample#load-avg-15m=4.205 sample#read-iops=0 sample#write-iops=0 sample#memory-total=16070696kB sample#memory-free=8936628kB sample#memory-cached=3756400kB sample#memory-redis=489296bytes sample#hit-rate=1 sample#evicted-keys=0
2024-05-28T14:59:36.062254+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/twitter/get_ER_by_username?handles=x&tweetsDesired=4" host=twitter-engagement-397330c3465e.herokuapp.com request_id=951feeb5-9986-4830-be8f-1e0a0291a940 fwd="91.73.75.168" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
 
Posted : 05/28/2024 3:03 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@thoufeeq87 it appears that your /cart.json endpoint isn't resolving to an appropriate file. Is it available on the server? Is the path different?

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 05/29/2024 1:05 am
(@thoufeeq87)
Posts: 6
Member Registered
Topic starter
 

@ssadvisor I really don’t know where is the path of /cart json. But my main issue is not that. The main critical issue is HEROKU time out. It only gives 30 sec to respond. How to resolve the timeout issue.Β 

when I running the program without hoisting it works perfectly even with the path issue. But when I hoist with HEROKU time out issue occurs.

 
Posted : 05/29/2024 1:34 am
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

@thoufeeq87 From the official Heroku Helpcenter : https://devcenter.heroku.com/articles/request-timeout

The timeout value is not configurable. If your server requires longer than 30 seconds to complete a given request, we recommend moving that work to a background task or worker to periodically ping your server to see if the processing request has been finished. This pattern frees your web processes up to do more work, and decreases overall application response times.

so you need to change the logic of your API, and if it requires that time, you may need to switch to your own server hosting.

 
Posted : 05/29/2024 1:10 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@thoufeeq87 the missing files add time to the processing needlessly. This may cause your timeout issue.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 05/29/2024 2:56 pm
Share:
[the_ad_group id="312"]