0
0

RspecのBigQuery操作でSignet::AuthorizationError

Last updated at Posted at 2024-07-16

事象

  • rspecでbigquery-emulatorに対してテストを実行した時に、以下のエラーが発生しました。
Signet::AuthorizationError:
  Authorization failed.  Server message:
  {"error":"invalid_grant","error_description":"Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim."}

原因

  • わかってしまえば簡単なのですが、rspecでtravel_to使って時間を止めてテストしたことです。
travel_to Time.zone.local(2027, 7, 10) do
  # 省略
end
  • BigQueryはJWT認証を使っているみたいで、iat,expに時刻が入るので、そこで壊れちゃった感じだと思います。
0
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
0
0