seal-io / walrus

Walrus is an open-source application management platform based on IaC tools including OpenTofu, Terraform and others. It helps platform engineers build golden paths for developers and empowers developers with self-service capabilities.
Apache License 2.0
426 stars 48 forks source link

Failed to delete resources: missing template or resource definition #2190

Open Finenyaco opened 8 months ago

Finenyaco commented 8 months ago

Describe the bug

Steps to reproduce

  1. Create a resource.
  2. Delete the resource by CLI: walrus resource delete <resource>.
  3. Delete the resource on UI.
  4. Check the resource list.

Result

  1. In step 2, deleted resource failed.
    unexpected status code 500 from https://localhost/v1/projects/default/environments/local/resources/second?preview=false&withoutCleanup=false, failed to delete a resource
  2. In step 3, failed to delete. image
2024-03-06T08:16:47.236Z    E   api error requesting DELETE /v1/projects/503617565914854658/environments/503617565914854658/resources?withoutCleanup=false: 1 error occurred:
    * missing template or resource definition

github.com/seal-io/walrus/pkg/apis/runtime.erroring
    github.com/seal-io/walrus/pkg/apis/runtime/middleware_error.go:45
github.com/gin-gonic/gin.(*Context).Next
    github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/seal-io/walrus/pkg/apis/runtime.recovering
    github.com/seal-io/walrus/pkg/apis/runtime/middleware_recovery.go:39
github.com/gin-gonic/gin.(*Context).Next
    github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/seal-io/walrus/pkg/apis/runtime.observing
    github.com/seal-io/walrus/pkg/apis/runtime/middleware_observation.go:89
github.com/gin-gonic/gin.(*Context).Next
    github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
    github.com/gin-gonic/gin@v1.9.1/gin.go:620
github.com/gin-gonic/gin.(*Engine).ServeHTTP
    github.com/gin-gonic/gin@v1.9.1/gin.go:576
github.com/seal-io/walrus/pkg/apis/runtime.(*Router).ServeHTTP
    github.com/seal-io/walrus/pkg/apis/runtime/router.go:194
net/http.serverHandler.ServeHTTP
    net/http/server.go:2938
net/http.initALPNRequest.ServeHTTP
    net/http/server.go:3546
net/http.(*http2serverConn).runHandler
    net/http/h2_bundle.go:6193
2024-03-06T08:16:47.237Z    D   api 500 | HTTP/2.0 |       39 B |       90 B |   53.134845ms |   192.168.117.1 | DELETE  /v1/projects/503617565914854658/environments/503617565914854658/resources?withoutCleanup=false

Expected behavior

Environment

Additional context Add any other context about the problem here.

Finenyaco commented 8 months ago

Environment

Test Result: Can not be reproduced in main.

image
Finenyaco commented 8 months ago

Environment

Test Result: This issue can be reproduced again but need to find ways to reproduce.

image
2024-03-08T07:53:55.254Z    E   api error requesting DELETE /v1/projects/503740965677225986/environments/503751901871921154/resources/503898482277406722?withoutCleanup=false: 1 error occurred:
    * missing template or resource definition

github.com/seal-io/walrus/pkg/apis/runtime.erroring
    github.com/seal-io/walrus/pkg/apis/runtime/middleware_error.go:45
github.com/gin-gonic/gin.(*Context).Next
    github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/seal-io/walrus/pkg/apis/runtime.recovering
    github.com/seal-io/walrus/pkg/apis/runtime/middleware_recovery.go:39
github.com/gin-gonic/gin.(*Context).Next
    github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/seal-io/walrus/pkg/apis/runtime.observing
    github.com/seal-io/walrus/pkg/apis/runtime/middleware_observation.go:89
github.com/gin-gonic/gin.(*Context).Next
    github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
    github.com/gin-gonic/gin@v1.9.1/gin.go:620
github.com/gin-gonic/gin.(*Engine).ServeHTTP
    github.com/gin-gonic/gin@v1.9.1/gin.go:576
github.com/seal-io/walrus/pkg/apis/runtime.(*Router).ServeHTTP
    github.com/seal-io/walrus/pkg/apis/runtime/router.go:194
net/http.serverHandler.ServeHTTP
    net/http/server.go:2938
net/http.initALPNRequest.ServeHTTP
    net/http/server.go:3546
net/http.(*http2serverConn).runHandler
    net/http/h2_bundle.go:6193
2024-03-08T07:53:55.255Z    D   api 500 | HTTP/2.0 |        0 B |       91 B |   26.204678ms |   192.168.216.1 | DELETE  /v1/projects/503740965677225986/environments/503751901871921154/resources/503898482277406722?withoutCleanup=false
alexcodelf commented 8 months ago

Can not find a proper way to reproduce it.