Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: unexpected bicep type: '' #2791

Closed
1 task done
EverybodyKurts opened this issue Sep 26, 2023 · 1 comment · Fixed by #2793
Closed
1 task done

panic: unexpected bicep type: '' #2791

EverybodyKurts opened this issue Sep 26, 2023 · 1 comment · Fixed by #2793
Assignees
Labels
Bicep bug Something isn't working core customer-reported identify a customer issue question

Comments

@EverybodyKurts
Copy link

Output from azd version

% docker run --rm mcr.microsoft.com/azure-dev-cli-apps:1.3.1 azd version 
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
azd version 1.3.1 (commit b5030da0f29ffe98664c40450187fd8a4cb0d157)

Describe the bug

An go error is thrown when azd provision is ran:

2023-09-26T16:53:41.6892285Z Provisioning Azure resources (azd provision)
2023-09-26T16:53:41.6892558Z Provisioning Azure resources can take some time
2023-09-26T16:53:41.6892661Z 
2023-09-26T16:53:41.7108538Z Downloading Bicep
2023-09-26T16:53:47.9599014Z Creating a deployment plan
2023-09-26T16:53:53.0771984Z Retrieving subscriptions...
2023-09-26T16:54:00.7781200Z panic: unexpected bicep type: ''
2023-09-26T16:54:00.7781714Z 
2023-09-26T16:54:00.7782015Z goroutine 1 [running]:
2023-09-26T16:54:00.7790655Z github.com/azure/azure-dev/cli/azd/pkg/infra/provisioning/bicep.(*BicepProvider).mapBicepTypeToInterfaceType(0x564cbb4c1780?, {0x0?, 0xc000015180?})
2023-09-26T16:54:00.7791329Z 	/mnt/vss/_work/1/s/cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go:1348 +0x22c
2023-09-26T16:54:00.7792572Z github.com/azure/azure-dev/cli/azd/pkg/infra/provisioning/bicep.(*BicepProvider).ensureParameters(0xc0003dd110, {0x564cbb6379c8, 0xc0004d45d0}, {{0xc000044660, 0x5b}, {0xc000014dd0, 0x7}, 0xc0002ec450, 0xc0002ec840}, 0xc000207650)
2023-09-26T16:54:00.7793141Z 	/mnt/vss/_work/1/s/cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go:1575 +0x75d
2023-09-26T16:54:00.7793777Z github.com/azure/azure-dev/cli/azd/pkg/infra/provisioning/bicep.(*BicepProvider).plan(0xc0003dd110, {0x564cbb6379c8, 0xc0004d45d0})
2023-09-26T16:54:00.7794244Z 	/mnt/vss/_work/1/s/cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go:354 +0x25a
2023-09-26T16:54:00.7795029Z github.com/azure/azure-dev/cli/azd/pkg/infra/provisioning/bicep.(*BicepProvider).Deploy(0xc0003dd110, {0x564cbb6379c8?, 0xc0004d45d0?})
2023-09-26T16:54:00.7795496Z 	/mnt/vss/_work/1/s/cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go:417 +0x6b
2023-09-26T16:54:00.7796106Z github.com/azure/azure-dev/cli/azd/pkg/infra/provisioning.(*Manager).Deploy(0xc0004745b0, {0x564cbb6379c8, 0xc0004d45d0})
2023-09-26T16:54:00.7796549Z 	/mnt/vss/_work/1/s/cli/azd/pkg/infra/provisioning/manager.go:56 +0x32
2023-09-26T16:54:00.7797019Z github.com/azure/azure-dev/cli/azd/cmd.(*provisionAction).Run.func1()
2023-09-26T16:54:00.7797396Z 	/mnt/vss/_work/1/s/cli/azd/cmd/provision.go:148 +0x71
2023-09-26T16:54:00.7798102Z github.com/azure/azure-dev/cli/azd/pkg/ext.(*EventDispatcher[...]).Invoke(0x564cbb641a80?, {0x564cbb6379c8, 0xc0004d45d0}, {0x564cbaf9896c, 0x9}, {0xc0004a86e0, 0x0?}, 0xc000340be8?)
2023-09-26T16:54:00.7798591Z 	/mnt/vss/_work/1/s/cli/azd/pkg/ext/event_dispatcher.go:113 +0x24b
2023-09-26T16:54:00.7799160Z github.com/azure/azure-dev/cli/azd/cmd.(*provisionAction).Run(0xc000474690, {0x564cbb6379c8, 0xc0004d45d0})
2023-09-26T16:54:00.7799568Z 	/mnt/vss/_work/1/s/cli/azd/cmd/provision.go:143 +0x3f7
2023-09-26T16:54:00.7800136Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x564cbb6379c8?, 0xc0004d45d0?})
2023-09-26T16:54:00.7800577Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/middleware.go:127 +0x2e8
2023-09-26T16:54:00.7801327Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*HooksMiddleware).registerCommandHooks(0xc00048dcc0?, {0x564cbb6379c8, 0xc0004d45d0}, 0x564cba717fa5?, 0xc0004a86e0?, 0xc00048d9c0)
2023-09-26T16:54:00.7801809Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/hooks.go:83 +0x2f5
2023-09-26T16:54:00.7802409Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*HooksMiddleware).Run(0xc00048dcc0, {0x564cbb6379c8?, 0xc0004d4450?}, 0xc00048d9c0)
2023-09-26T16:54:00.7802851Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/hooks.go:67 +0x1d8
2023-09-26T16:54:00.7803444Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x564cbb6379c8, 0xc0004d4450})
2023-09-26T16:54:00.7803878Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
2023-09-26T16:54:00.7804522Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*TelemetryMiddleware).Run(0xc00006eff0, {0x564cbb6379c8, 0xc000497b30}, 0xc00048d9c0)
2023-09-26T16:54:00.7805184Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/telemetry.go:75 +0x759
2023-09-26T16:54:00.7805759Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x564cbb6379c8, 0xc000497b30})
2023-09-26T16:54:00.7806189Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
2023-09-26T16:54:00.7841878Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*ExperimentationMiddleware).Run(0x564cbaf9f71e?, {0x564cbb6379c8, 0xc000497b30}, 0xc00048d9c0)
2023-09-26T16:54:00.7842567Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/experimentation.go:64 +0x4d6
2023-09-26T16:54:00.7843189Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x564cbb6379c8, 0xc000497b30})
2023-09-26T16:54:00.7843626Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
2023-09-26T16:54:00.7844253Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*DebugMiddleware).Run(0xc00048eb70, {0x564cbb6379c8, 0xc000497b30}, 0xc00048d9c0)
2023-09-26T16:54:00.7845791Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/debug.go:48 +0x311
2023-09-26T16:54:00.7846525Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x564cbb6379c8, 0xc000497b30})
2023-09-26T16:54:00.7847484Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/middleware.go:125 +0x2a2
2023-09-26T16:54:00.7848115Z github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction(0xc000415230, {0x564cbb6379c8, 0xc000497b30}, 0x564cbb403ce0?, {0x564cbb62d098?, 0xc000474690})
2023-09-26T16:54:00.7848506Z 	/mnt/vss/_work/1/s/cli/azd/cmd/middleware/middleware.go:131 +0x226
2023-09-26T16:54:00.7849146Z github.com/azure/azure-dev/cli/azd/cmd.(*CobraBuilder).configureActionResolver.func1(0xc00040e500, {0xc0004af6a0?, 0x0, 0x1})
2023-09-26T16:54:00.7849487Z 	/mnt/vss/_work/1/s/cli/azd/cmd/cobra_builder.go:143 +0x4ef
2023-09-26T16:54:00.7849767Z github.com/spf13/cobra.(*Command).execute(0xc00040e500, {0xc0004af690, 0x1, 0x1})
2023-09-26T16:54:00.7850081Z 	/home/cloudtest/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x694
2023-09-26T16:54:00.7850371Z github.com/spf13/cobra.(*Command).ExecuteC(0xc0003b9900)
2023-09-26T16:54:00.7850658Z 	/home/cloudtest/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x38d
2023-09-26T16:54:00.7850931Z github.com/spf13/cobra.(*Command).Execute(...)
2023-09-26T16:54:00.7851191Z 	/home/cloudtest/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
2023-09-26T16:54:00.7851516Z github.com/spf13/cobra.(*Command).ExecuteContext(0x564cbb108400?, {0x564cbb637990?, 0x564cbbc8da00?})
2023-09-26T16:54:00.7851843Z 	/home/cloudtest/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:895 +0x47
2023-09-26T16:54:00.7852083Z main.main()
2023-09-26T16:54:00.7852291Z 	/mnt/vss/_work/1/s/cli/azd/main.go:61 +0x1f0
2023-09-26T16:54:00.7942524Z ##[error]Script failed with exit code: 2
2023-09-26T16:54:00.7993788Z [command]/usr/bin/az account clear
2023-09-26T16:54:01.6658122Z ##[section]Finishing: Provision Infrastructure

To Reproduce

I'm currently trying to provision infrastructure via the azd provision command using the new feature, "user defined types", enabled via bicepconfig.json:

{
  // See https://aka.ms/bicep/config for more information on Bicep configuration options
  // Press CTRL+SPACE/CMD+SPACE at any location to see Intellisense suggestions
  "analyzers": {
    "core": {
      "rules": {
        "no-unused-params": {
          "level": "error"
        }
      }
    }
  },
  "experimentalFeaturesEnabled": {
    "extensibility": true,
    "userDefinedTypes": true,
    "compileTimeImports": true
  }
}

Here is the simple user defined type I created:

@export()
type environmentTypes = 'sandbox' | 'dev' | 'test' | 'prod'

Expected behavior

The stack trace isn't very helpful and I don't know where in my bicep code is causing the crash. At least tell me the line number in the compiled ARM json file where it throws the error.

@EverybodyKurts EverybodyKurts changed the title [Issue] panic: unexpected bicep type: '' panic: unexpected bicep type: '' Sep 26, 2023
@rajeshkamal5050 rajeshkamal5050 added Bicep core bug Something isn't working labels Sep 26, 2023
@rajeshkamal5050 rajeshkamal5050 added this to the October 2023 - 1.4.0 milestone Sep 26, 2023
@vhvb1989
Copy link
Member

@EverybodyKurts , this an issue on azd while trying to handle the parameter. A fix has been created: #2793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bicep bug Something isn't working core customer-reported identify a customer issue question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants