Unable to purge gateway using ttn cli

Hi There,

I am unable to purge gateway using ttn cli command

error
ttn-lw-cli gateways purge --gateway-id b827ebfffe2c6551
WARN This action will permanently delete the gateway and all related data (API keys, antennas, attributes etc.)
WARN Are you sure? Confirm your choice:
[Y/n]> y
WARN Finished unary call {“duration”: 0.1439, “error”: “error:pkg/identityserver:admins_purge_gateways (gateways may only be purged by admins)”, “error_correlation_id”: “5389e5761b484189a1316ca0e73c84cf”, “error_name”: “admins_purge_gateways”, “error_namespace”: “pkg/identityserver”, “grpc.method”: “Purge”, “grpc.service”: “ttn.lorawan.v3.GatewayRegistry”, “grpc_code”: “PermissionDenied”, “namespace”: “grpc”, “request_id”: “3d9e15b0-f835-43b2-b22f-0c7990e9255f”}
error:pkg/identityserver:admins_purge_gateways (gateways may only be purged by admins)
correlation_id=5389e5761b484189a1316ca0e73c84cf

I am having the same issue did you ever get this resolved?

Thanks

“ttn.lorawan.v3.GatewayRegistry”, “grpc_code”: “PermissionDenied”, “namespace”: “grpc”, “request_id”: “3d9e15b0-f835-43b2-b22f-0c7990e9255f”}
error:pkg/identityserver:admins_purge_gateways (gateways may only be purged by admins)

I think that error message is pretty clear. Only admins can purge gateways.

Are you trying to purge it on a local version of The Things Stack or on The Things Stack Community Edition?

Hello @KrishnaIyerEaswaran2, I’m also getting the same error when I try to purge one of my gateways. Its weird because I’ve have logged in from the cli and redirected to a browser for the Oauth authentification. Even after logging in with my account which I am the only collaborator, I’m still getting this error.

The key word here is admin. Are you an admin to the network in which you’re trying to purge entities?

Hi, I have the same issue. By the way I’m really fresh beginning with ttn.
So better I describe a little more before:

  1. I created an account in the ttn console and login with my well known loginname and pw to eu1.cloud.thethings.network. Dhe permission is set in console Grant all current and future rights in my acconts name under Collaborateurs section so I guess I have admin rights, isn’t it?
  2. I created an gateway with an well known gateway id, though it was wrong created so simply deleted it after creation.
  3. After find out it is not possible to recreate the gateway in the console and must purge command in the ttn-lw-cli I installed the latest package.
  4. I could login with my account-name and the known password I used by using a fresh created config file descibed here: Manual create config file section
  5. I simply tried to use ttn-lw-cli gateways purge eui-XXXXXXXX --force with my known gateways-id which answers …gateways may only be purged by admins…

So I think something is missing to become a admin?

By the way it was possible to restore the gateway by using
ttn-lw-cli gateways restore eui-XXXXXXXXXXXX
It looks like admin rights are not needed for restore so really I thing I must do something to get real admin rights and gaven Grant all current and future rights at ttn consele is mybe not enough. Can anybody give me a hint what is to do?

That’s incorrect. You need admin rights to purge or restore Identifiers.

Ok, and why then is restore possible but not purge:

$ ttn-lw-cli gateways purge eui-XXXXXXXXXXXXXX --force
INFO Telemetry is enabled. Check the documentation for more information on what is collected and how to disable it {“documentation_url”: “CLI Telemetry | The Things Stack for LoRaWAN”}
WARN [dns]dns: TXT record v=spf1 -all missing grpc_config= attribute
WARN Finished unary call {“duration”: 0.045, “error”: “error:pkg/identityserver:admins_purge_gateways (gateways may only be purged by admins)”, “error_correlation_id”: “XXXXXXXXXXXXXXXXXXXX”, “error_name”: “admins_purge_gateways”, “error_namespace”: “pkg/identityserver”, “grpc.method”: “Purge”, “grpc.service”: “ttn.lorawan.v3.GatewayRegistry”, “grpc_code”: “PermissionDenied”, “namespace”: “grpc”, “request_id”: XXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX"}
error:pkg/identityserver:admins_purge_gateways (gateways may only be purged by admins)
correlation_id=XXXXXXXXXXXXXXXXXXXXXXXX

$ ttn-lw-cli gateways delete eui-XXXXXXXXXXXXX
INFO    Telemetry is enabled. Check the documentation for more information on what is collected and how to disable it   {"documentation_url": "https://www.thethingsindustries.com/docs/reference/telemetry/cli"}
WARN    [dns]dns: TXT record v=spf1 -all missing grpc_config= attribute
INFO    New patch version available     {"current": "3.28.1", "docs_url": "https://www.thethingsindustries.com/docs/getting-started/upgrading/", "latest": "3.28.2"}

$ ttn-lw-cli gateways purge eui-XXXXXXXXXXXXX --force
INFO    Telemetry is enabled. Check the documentation for more information on what is collected and how to disable it   {"documentation_url": "https://www.thethingsindustries.com/docs/reference/telemetry/cli"}
WARN    [dns]dns: TXT record v=spf1 -all missing grpc_config= attribute
WARN    Finished unary call     {"duration": 0.0468, "error": "error:pkg/identityserver:admins_purge_gateways (gateways may only be purged by admins)", "error_correlation_id": "XXXXXXXXXXXXXXXXXX", "error_name": "admins_purge_gateways", "error_namespace": "pkg/identityserver", "grpc.method": "Purge", "grpc.service": "ttn.lorawan.v3.GatewayRegistry", "grpc_code": "PermissionDenied", "namespace": "grpc", "request_id": "XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXX"}
error:pkg/identityserver:admins_purge_gateways (gateways may only be purged by admins)
    correlation_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXX

$ ttn-lw-cli gateways restore eui-XXXXXXXXXXXXX
INFO    Telemetry is enabled. Check the documentation for more information on what is collected and how to disable it   {"documentation_url": "https://www.thethingsindustries.com/docs/reference/telemetry/cli"}
WARN    [dns]dns: TXT record v=spf1 -all missing grpc_config= attribute
INFO    New patch version available     {"current": "3.28.1", "docs_url": "https://www.thethingsindustries.com/docs/getting-started/upgrading/", "latest": "3.28.2"}

I hope you can identify the cause. Could it be anotther issue not related to the written message?

Actually, you’re right. Restore does not need admin rights but purge does. I misspoke earlier.

Ok, can you help me how to get the missing right? I’m confused about the docs.

Since you are using a public cluster eu1.cloud.thethings.network (The Things Stack Sandbox), you cannot get admin access. If you DM me a list of the IDs, I can purge them for you.

1 Like

Hi Krishna,
Can you purge my deleted gateway?
“gateway_id”: “eui-ac1f09fffe0bda39”,
“eui”: “AC1F09FFFE0BDA39”

Thanks,
Antonio Valente

Hello, I’m doing some test on ttn sandbox. I registered some gateways. But I plan to move to paid cloud the thing stack. Then I will need to purge gateways here on sandbox to be able to register them with the same EUI on Cloud tts. Do will I need your assistance to purge gateways on sandbox?

Best Regards
Jindrich Pastorek

TTS Sandbox and TTS Cloud are different deployments. You won’t need to purge from one to use it in the other :slight_smile: