LoginSignup
2
0

More than 3 years have passed since last update.

Gofeed利用時に発生した「Failed to detect feed type」の対応

Posted at

現象

Cloud Functionsを利用して、gofeedでブログをパースしようとしたところ、以下のメッセージと共にエラーが発生。

  Failed to detect feed type
main.go
  fp := gofeed.NewParser()
  feed, _ := fp.ParseString(xmlData) // ここでエラー

原因切り分けのために条件を変えて実行したところ、以下がわかった。

  • エラーが発生しないブログもある
  • ローカルで実行するとエラーにならない

環境

  • Golang 1.11.0
  • gofeed v1.0.0-beta2
  • Google Cloud SDK 264.0.0

原因

httpアクセスする際のCloud FunctionsのIPアドレスがブログ側からブロックされてしまったためと思われる。

対応

Cloud Functionsのregionをasia-northeast1からus-east1に変更したところ、正常に処理が完了した。

参考

https://github.com/mmcdole/gofeed/issues/75
https://github.com/mmcdole/gofeed/issues/96

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0