Skip to content

Fix local deploy compilation for large module templates#19754

Open
GABRIELNGBTUC wants to merge 2 commits into
Azure:mainfrom
GABRIELNGBTUC:feature/fix-19750
Open

Fix local deploy compilation for large module templates#19754
GABRIELNGBTUC wants to merge 2 commits into
Azure:mainfrom
GABRIELNGBTUC:feature/fix-19750

Conversation

@GABRIELNGBTUC

@GABRIELNGBTUC GABRIELNGBTUC commented May 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #19750

Description

Removes the 132k characters limit for compiled modules in local deploys by using the JSON writer instead of the text writer.

Tested against a production bicep file blocked by this issue and no side effects have been noticed.

Checklist

When `targetScope = 'local'`, module `properties.template` was emitted via
`EmitProperty(string, string)`, which serialized it as an ARM expression
string literal and hit the 131072-character literal limit for large modules.

This change emits the nested module template as a plain JSON string value in
`TemplateWriter.EmitModuleForLocalDeploy`, avoiding expression literal
serialization and preventing the internal `ExpressionException`.

Also adds regression test `Test_Issue19750` in `ScenarioTests` to verify
large local module templates compile successfully and are emitted as valid
JSON string content.
@GABRIELNGBTUC GABRIELNGBTUC marked this pull request as ready for review May 29, 2026 12:18
Comment thread src/Bicep.Core/Emit/TemplateWriter.cs Outdated

@anthony-c-martin anthony-c-martin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See suggested fix

Co-authored-by: Anthony Martin <38542602+anthony-c-martin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local deploy cannot compile files with modules compiling to more than 131k characters

2 participants