Twilio Flex Pluginでのデプロイ時のエラー


バージョン

twilio-cli / 2.10.3
flex-plugin / 4.0.2-beta.0

Twilioコマンドでデプロイ時に謎のエラーが発生した…

まだ何もデプロイしてない状態で初デプロイしたら何故かエラーが出た。

デプロイコマンド

twilio flex:plugins:deploy --changelog='deploy'

エラー内容

※IDはマスクしてます

Error code 20404 from Twilio: The requested resource /Services/ZSXXXXXXX/Environments was not found.
See https://www.twilio.com/docs/errors/20404 for more info.

上記のリソースが無いと言われてるのはわかるけど、何のIDですかそれ

心当たりは…?

プラグインのデプロイより前に、serverlessの方(functionsとassetsの方)で
デプロイした時後に、defaultのServiceを手動で削除したけど
それのSIDをプラグインが参照してた…??

追記
やはりここでdefaultのサービスを削除してしまっていたからというのが原因でした

defaultサービスのSIDなんて覚えてない~

もうね、サポートに聞いちゃいます!

ほんとに、にっちもさっちも状態だったのでサポートに問い合わせて見ました。
返信あるのか不安でしたが、翌日には返信が…!

英語ですが全文載せときます

長いので折りたたんでます

返信内容

Thank you for reaching out about about this!

I'm sorry to hear that you are receiving an error 20404 when attempting to deploy your plugin.
This is most likely occurring because the the Plugin Builder is looking for a field called "serverless_service_sids" in your account's configuration and it sounds like that SID was deleted.

This can be fixed by resetting the value in your account's configuration and running twilio flex:plugins:deploy again.
The command to reset the value is shown below. You need to replace the ACCOUNT_SID and AUTH_TOKEN fields with the account information on your Twilio console home page.

curl  https://flex-api.twilio.com/v1/Configuration \
    -H "Content-Type: application/json" \
    -d '{"account_sid":"ACCOUNT_SID", "serverless_service_sids": []}' \
    -u ACCOUNT_SID:AUTH_TOKEN

After running this command, the next time you run twilio flex:plugins:deploy the configuration field should be set to the correct value.

ざっくりいうと、serverless_service_sidsというのを参照してるけど、削除されてるような感じなので
リセットしてください。
コマンドはこれです。実行したら再度デプロイしてね。

って感じでしょうか??

とりあえずこのコマンドをやってみます

serverless_service_sidsリセットコマンド?

curl  https://flex-api.twilio.com/v1/Configuration \
    -H "Content-Type: application/json" \
    -d '{"account_sid":"ACCOUNT_SID", "serverless_service_sids": []}' \
    -u ACCOUNT_SID:AUTH_TOKEN

serverless_service_sidsを空にしますって感じ?

curlコマンド打てないので(Windowsで入れてないので…)
ChromeのAPI Testerを使って叩いてみました。

すると、何か色々入ったJsonが返ってきましたが、serverless_service_sidsは空になってました。

これでリセットされたってことなんかな??

再度デプロイしてみる

ていっ

twilio flex:plugins:deploy --changelog='deploy'
√ Validating deployment of plugin plugin-XXXXX
√ Compiling a production build of plugin-XXXXX
√ Uploading plugin-XXXXX
√ Registering plugin plugin-XXXXX with Plugins API
√ Registering version v0.0.1 with Plugins API

� Plugin (private) [email protected] was successfully deployed using Plugins API

成功した!!

まとめ

結局何が原因でこうなったかはわかりませんが(サポートに原因も聞いてみてるので返信あれば追記します)
とりあえず同じ現象が起こったら、このリセットコマンドがあるということで。

追記

現在設定されている、serverless_service_sidsがわかるコマンドを教えてもらいました。

curl -X GET 'https://flex-api.twilio.com/v1/Configuration' \
-u your_account_SID:your_auth_token

実行結果のserverless_service_sidsに、↑でデプロイした時に出来たdefault servicesのSIDが入っていました。
なので、defaultのserviceを消すと、このエラーが発生してしまうようです。