OH-SHOWN / ohshown-backend

OH!SHOWN 野生動物出沒痕跡通報系統
http://ohshown.site
MIT License
2 stars 8 forks source link

[Deployment] imgur upload error #38

Open tai271828 opened 2 years ago

tai271828 commented 2 years ago

development site 又不能上傳了,這次是透過 domain name 不行、但 IP 可以(之前是相反)

說不定是 imgur 對同一位置的單日上傳上限。

Next action: Study why the upload error shows up randomly.

tai271828 commented 2 years ago

Hmmm I think we are far from this restriction:

Each application can allow approximately 1,250 uploads per day or approximately 12,500 requests per day. If the daily limit is hit five times in a month, then the app will be blocked for the rest of the month. 

https://api.imgur.com/#:~:text=Each%20application%20can%20allow%20approximately,the%20rest%20of%20the%20month.

tai271828 commented 2 years ago

Interesting, when using the domain, for some reasons It falls back to use localhost:

Failed to load resource: net::ERR_FAILED
:8080/server/api/images:1 Failed to load resource: the server responded with a status of 403 (Forbidden)
imageUpload.ts?ef95:27 Error: Request failed with status code 403
    at createError (webpack-internal:///./node_modules/axios/lib/core/createError.js:16)
    at settle (webpack-internal:///./node_modules/axios/lib/core/settle.js:17)
    at XMLHttpRequest.handleLoad (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:59)
eval @ imageUpload.ts?ef95:27
:8080/#map=14.00/120.50710867662632/24.107157308511262:1 Access to XMLHttpRequest at 'http://localhost:8080/sockjs-node/info?t=1643213968489' from origin 'http://ohshown.site:8080' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `local`.
tai271828 commented 2 years ago

disfactory-backend/backend$ git reset --hard a29dd525bf6ba3bd18498300969c603baa3f7672 and I could still reproduce this issue. It means the recent change of backend does not raise the regression.

tai271828 commented 2 years ago

Another clue (hopefully it is not read herring) is that I noticed the Network status of the frontend is unavailable.

 DONE  Compiled successfully in 12340ms                                            3:40:01 PM                                                                                          [0/433]

No type errors found                           
Version: typescript 3.9.7                      
Time: 7930ms                                   

  App running at:                              
  - Local:   http://localhost:8080/            
  - Network: unavailable 
tai271828 commented 2 years ago

disfactory-backend/backend$ git reset --hard a29dd525bf6ba3bd18498300969c603baa3f7672 and I could still reproduce this issue. It means the recent change of backend does not raise the regression.

Similar to the idea but for fronted, aee08a84d4e2ab43252dedf64af38f6a96db05a0 does not introduce this issue.

tai271828 commented 2 years ago

Did not reproduce for a while. Re-open when it shows up again.

tai271828 commented 2 years ago

Both the domain name and IP failed to upload images this time! https://github.com/tai271828/disfactory-frontend/pull/65#issuecomment-1070812266