We have developed a mobile app represented by a connected app in Salesforce, which has been configured for iOS & Android push notifications. We have done this for other connected apps in 1GP managed packages and are able to send PNs ok. But, having tried to add the connected app into a 2GP package release, when we try to send a PN from an Apex REST controller (within the same 2GP package) we receive an error: "System.NoAccessException: Invalid connected application" ... our connected app name & namespace... (System Code)"

I've followed the steps here to create the connected app in a 1GP packaging org, created a 1GP package release, and added the XML metadata file to my 2GP project (ensuring that version is 2.0 vs the 3.0 version in the MP release). The namespace of the 1GP packaging org and the 2GP sfdx-project.json matches too.

The 2GP package version is created successfully but, after installing it in another org, the "Metadata Components Included in Package" list does not include the connected app, nor is it shown in app manager. I'm not even 100% sure that the connected app definition needs to be packaged in order for PNs to work. I'm also aware of the advice on this page so I'm using an Apex REST controller included in the package to send a test PN.

Any advice on how to debug this further would be very much appreciated!


You must log in to answer this question.

Browse other questions tagged .