AL-Go icon indicating copy to clipboard operation
AL-Go copied to clipboard

AppSource App deployment failes with PerTenantExtensionCop Error PTE0001 and PTE0002

Open louagej opened this issue 1 year ago • 5 comments

I have an app that was generated from the generated from AL-Go-AppSource template.

When the CICD runs we get an error during deployment, telling: Deploying to UAT failed. Unable to publish app. Please open the Extension Deployment Status Details page in Business Central to see the detailed error message.

image

In the Status Details page of Business Central I get these error messages:

Package validation failed due to the following error(s): src/codeunit/NALRaptEmailMgtFunctions.Codeunit.al (4,10) - Error PTE0001: Codeunit 'NAL Rapt. Email Mgt. Functions' has an ID of [2057753]. It must be within the range '[50000..99999]'.
src/codeunit/NALRaptFwdLinkMgt.Codeunit.al (5,10) - Error PTE0001: Codeunit 'NAL Rapt. Fwd Link Mgt.' has an ID of [2057754]. It must be within the range '[50000..99999]'.
src/tableextension/NALRaptPPInvViewDoc.TableExt.al (5,15) - Error PTE0002: Field 'NAL Raptor Batch Run' has an ID of [2057742]. It must be within the range '[50000..99999]'.
src/tableextension/NALRaptPPInvViewDoc.TableExt.al (10,15) - Error PTE0002: Field 'NAL Raptor Batch Run Date' has an ID of [2057743]. It must be within the range '[50000..99999]'.
...

Any idea what caused this error message?

louagej avatar May 15 '24 11:05 louagej

When deploying AppSource Apps to online sandbox environments, you need to use impersonation (not S2S) for authentication. I assume you have setup S2S, which causes AL-Go to attempt PTE installation.

freddydk avatar May 15 '24 12:05 freddydk

@freddydk , yes indeed that's the reason. Maybe a good idea to add the scope option when using S2S Authentication as mentioned in 980 Allow Scope to be PTE in continuousDeployment for PTE extensions in Sandbox (enhancement request)

louagej avatar May 15 '24 12:05 louagej

You cannot install an app in the Dev scope when using S2S - for S2S, only PTE scope is possible. For impersonation, it makes sense to have the scope (PTE or Dev)

freddydk avatar May 15 '24 13:05 freddydk

And is publishing with scope Global possible from an AL-Go action with S2S for AppSource apps?

louagej avatar May 15 '24 13:05 louagej

Not sure - I would have to investigate this

freddydk avatar May 15 '24 13:05 freddydk

Global scope is a thing, yes. You can't directly publish to it, global scope is only available to apps from AppSource which has passed through AppSource submission process, so nothing for AL-Go to support. You can install an app from global scope just the same as you would any other app though, as long as it is available in AppSource.

I do however think it would be a good idea to add a setting to the deployment Settings structure called "Scope", which can be Default, PTE or Dev (or something like that). Default works as today - PTE or Dev forces the scope and an error will be thrown if the scope is not allowed (appsource app as PTE)

freddydk avatar May 22 '24 07:05 freddydk