delete empty application failed

hello
when I tried(both via GUI and cmd) to delete an empty application, it always gets the timeout issue
Is there any problem with balena cloud? (i tried same activity in my test openbalena, works well)

thank you very much

1 Like

Hi, can you tell us what error you are getting? You can inspect network errors in browser’s dev console -> network tab. cli log is also interesting.

2 Likes

here are the cli log

[root@mting-test ~]# export DEBUG=1
[root@mting-test ~]# ./balena/balena-cli/balena app rm test-old
[debug] original argv0="./balena/balena-cli/balena" argv=[/root/balena/balena-cli/balena,/snapshot/versioned-source/bin/balena,app,rm,test-old] length=5
? Are you sure you want to delete the application? Yes
network timeout at: https://api.balena-cloud.com/v5/application(1461206)
FetchError: network timeout at: https://api.balena-cloud.com/v5/application(1461206)
at Timeout._onTimeout (/snapshot/versioned-source/node_modules/node-fetch/index.js:126:13)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
From previous event:
at new Fetch (/snapshot/versioned-source/node_modules/node-fetch/index.js:49:9)
at Fetch (/snapshot/versioned-source/node_modules/node-fetch/index.js:37:10)
at module.exports.fetch.Promise (/snapshot/versioned-source/node_modules/fetch-ponyfill/fetch-node.js:15:12)
at requestAsync (/snapshot/versioned-source/node_modules/balena-request/build/utils.js:333:7)
From previous event:
at requestAsync (/snapshot/versioned-source/node_modules/balena-request/build/utils.js:352:22)
at exports.getRequestAsync (/snapshot/versioned-source/node_modules/balena-request/build/utils.js:402:12)
at /snapshot/versioned-source/node_modules/balena-request/build/request.js:184:14
From previous event:
at Object.module.exports.exports.send (/snapshot/versioned-source/node_modules/balena-request/build/request.js:183:89)
at /snapshot/versioned-source/node_modules/balena-pine/build/pine.js:90:24
From previous event:
at BalenaPine._request (/snapshot/versioned-source/node_modules/balena-pine/build/pine.js:89:10)
at BalenaPine.PinejsClientCoreFactory.PinejsClientCore.request (/snapshot/versioned-source/node_modules/pinejs-client-core/core.js:902:29)
at BalenaPine.PinejsClientCoreTemplate.delete (/snapshot/versioned-source/node_modules/pinejs-client-core/core.js:775:21)
at /snapshot/versioned-source/node_modules/balena-sdk/build/models/application.js:542:28
From previous event:
at Object.exports.remove (/snapshot/versioned-source/node_modules/balena-sdk/build/models/application.js:541:28)
at /snapshot/versioned-source/build/actions/app.js:125:40
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:120:23)
From previous event:
at Command.action (/snapshot/versioned-source/build/actions/app.js:124:94)
at /snapshot/versioned-source/node_modules/capitano/build/command.js:98:37

If you need help, don’t hesitate in contacting our support forums at
https://forums.balena.io

For CLI bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

1 Like

Hello, I tried reproducing the issue but I seem to be able to delete empty applications both from the UI and from balena-cli. Can you try again to confirm the issue was not actually just a network timeout?

1 Like

you could see that all other commands are working fine, just this one get timeout everytime

[root@mting-test ~]# ./balena/balena-cli/balena device 1515e9a17f9d3ce64624722d4a907f13
[debug] original argv0="./balena/balena-cli/balena" argv=[/root/balena/balena-cli/balena,/snapshot/versioned-source/bin/balena,device,1515e9a17f9d3ce64624722d4a907f13] length=4
== NN
ID: 2004771
DEVICE TYPE: qemux86-64
STATUS: idle
IS ONLINE: true
IP ADDRESS: 192.168.222.1
APPLICATION NAME: router-v2
UUID: 1515e9a17f9d3ce64624722d4a907f13
COMMIT: 650fcba63299cab7258fd3956b0bb705
SUPERVISOR VERSION: 9.15.7
IS WEB ACCESSIBLE: false
OS VERSION: balenaOS 2.38.0+rev1
DASHBOARD URL: https://dashboard.balena-cloud.com/devices/1515e9a17f9d3ce64624722d4a907f13/summary
[root@mting-test ~]# ./balena/balena-cli/balena app test-old
[debug] original argv0="./balena/balena-cli/balena" argv=[/root/balena/balena-cli/balena,/snapshot/versioned-source/bin/balena,app,test-old] length=4
== TEST OLD
ID: 1461206
DEVICE TYPE: intel-nuc
COMMIT: e358ffad5049369478c551defe3baf1a

1 Like

Thanks. One more thing, can you confirm this also happens if you create a new application and attempt to delete that?

1 Like

create new , then delete it , its no prbolem.
here are some details about this app
first the name is test, and I have deploy 2 devices in it.
then I delete all devices, rename it to test-old and create a new app name test.
when i try to delete this test-old, this issue came up

1 Like

Hi @mting,

We’ve taken a look into this, and a couple of us have tried the same process as you (create app, attach devices, delete devices, rename app, create new app with old name, delete old app) and this does appear to be working correctly.

What would be really useful is to enable the developer tools on your browser and then save all the network timings from it so we can have a look. This would give us an idea of what might be happening. Also, does your local network use a proxy or any other sort of middleware networking that might be affecting traffic on your network?

Best regards,

Heds

1 Like

there is not any proxy and console log attached
dashboard.balena-cloud.com-1585813828635.log (31.7 KB)

this log is more clear , it just from before click the delete
dashboard.balena-cloud.com-1585814545441.log (16.9 KB)

Hey, to debug this further can you share the network logs and your current browser https://www.whatsmybrowser.org/

here is it

Hi, we’ve investigated this further, and it seems related to the large number of releases in this application that is causing it to timeout. We’re investigating some optimizations in this regard, and as a workaround, you would have to manually delete the releases for this application.

The simplest way to do this is from the developer tools console in the browser. Once the dev tools console is open, you can run the following command replacing the applicationId with that of your application.

await sdk.pine.delete({ resource: 'release', options: { $filter: { application: applicationId } } })

It’s possible this will also timeout but would be worth a try. Unfortunately, this isn’t currently possible to do this via the dashboard though there is an open issue for this.

After those releases have been removed, it should be possible to delete the app successfully.

I just tried it

[root@mting-test ~]# ./balena/balena-cli/balena app test-old
== TEST OLD
ID: 1461206
DEVICE TYPE: intel-nuc
COMMIT: e358ffad5049369478c551defe3baf1a

await sdk.pine.delete({ resource: ‘release’, options: { $filter: { application: 1461206 } } })

but got 500 from server

dashboard.balena-cloud.com-1585858780243.log (12.8 KB)

Hey, your query is slightly wrong, it should be belongs_to__application, rather than just application. If this then times out, you could try to reduce the amount of releases that you delete at one time:

await sdk.pine.delete({ resource: ‘release’, options: { $filter: { belongs_to__application: 1461206 }, $top: 100 } })

This would delete 100 releases, so if you ran that 4 times, you would then have no release and could delete your app without it timing out. If this is too many, you could decrease the $top amount and run it more times.

Let me know if you’d like me to run this process for you.

I’ve raised this internally, as it seems like release deletions take a lot longer than perhaps they should, so we will investigate that too.

hello
yes , please do that for me, then you could take more analysis.
I’m not familiar with nodejs
thank you

Hi there, you can actually run the query from the console in your browser’s DevTools. If you navigate to the balenaCloud dashboard, open the console with CMD + Option + I (on a Macbook, probably CTRL + ALT + I on other OSs) and in the console there you just copy-paste the line from above it should delete the releases as expected. Let us know how that goes, and we can help out if you are having issues.

@mting I can handle this for you now, please ensure that support access is enabled.

i have enabled it
thank you

@mting all done!