3

When deploying all of our org's components and running all tests (Using a Force.com Migration Tool target invoked from Jenkins), we receive the following fatal deployment error:

UNKNOWN_EXCEPTION: A Definition of type 'EVENT' can not be added to this bundle.

There doesn't seem to be any indication of what component/file is causing this error, which makes it difficult to troubleshoot.

My guess is that this is somehow referring to a Lightning event in an aura definition bundle. We have around 30 aura components that all appear to be working correctly in our sandbox. 6 of those components are Lightning Events.

Any insight into what this error means (or how to start troubleshooting it) would be helpful.

4 Answers 4

4

I received the same error message recently after I had accidentally created a component with an event inside it, e.g.:

src/aura/myComponent
  myComponent.cmp
  myComponent.evt

Note that the documentation for AuraDefinitionBundle states that

Each bundle can have only one file each with a suffix of .app, .cmp, .design, .evt, .intf, or .tokens.

Check your Aura components to ensure that they are obeying this rule (probably could be automated with a script fairly easily if you don't want to look through all of them by hand).

Otherwise, perhaps Salesforce has gotten confused if you tried to create an Event with the same name as a Component, Application, Interface, etc.

Additionally, ensure that you don't have an <aura:component> in a file ending in .evt, or <aura:event> in a file not ending in .evt

2
  • This was also my first thought that it could be a kind of naming collision, would make sense (in terms of causing the error) what you have described. Aug 23, 2016 at 16:15
  • Two developers deployed code to our Git repository. Developer A deployed a Lightning component called "MyComponentName" while developer B deployed a Lightning event that was also named "MyComponentName." Both of these components are put in a directory called "MyComponentName", so Git added the files from the event into the same directory as those of the component. Git did not detect a merge conflict because there were no shared file names, only a shared directory. The solution was to name the event and the component different names and re-build. Aug 25, 2016 at 14:53
2

Uploading event components as bundles works for me.

I believe API version should help you - try setting API version of the component (in the metadata file) to 37

And tell if it helps - it is interesting.

Itai

2
  • We made sure the API version numbers were set to match the org (37.0) but that did not resolve the issue. Aug 16, 2016 at 15:59
  • I faced the same issue and the problem was the API 36. I updated to 42 and worked. ALSO check if you are using the same API version in all your XMLs files from your bundle. Aug 30, 2018 at 13:07
1
+50

I ran into a similar error a couple of weeks ago:

UNKNOWN_EXCEPTION: A Definition of type 'COMPONENT' can not be added to this bundle.

The cause was that in the source org a file named 'cart.app' was deleted and replaced with 'cart.cmp'. The fix was to delete 'cart.app' file in the destination org. Have you changed the file types of any files?

1
  • Haven't verified this answer yet but it's our only lead so far. Aug 23, 2016 at 16:30
0

I ran into this error when I tried changing an Aura app to an Aura component in my package. After a good bit of trial and error, I deleted the original Aura app from the package, deployed it (which succeeded), and re-added it as a component. After that I was able to deploy with no problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .