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

Leprechaun crashes when faced Sitecore cli items include with "scope": "descendants Only" #44

Closed
Viktar-Semiarykou opened this issue Sep 28, 2021 · 5 comments
Labels

Comments

@Viktar-Semiarykou
Copy link

var templateItemData = module.DataStore.GetItemDataSync(module.DataStore.GetTreeNodeSync(fsTreeSpec.Path));

module.DataStore.GetTreeNodeSync(fsTreeSpec.Path) returns null

That leads to null reference exception

@blipson89
Copy link
Owner

Hi! Could you please attach your .module.json file, as well as your leprechaun.config file

you can replace any sensitive names/paths with placeholder values

@Viktar-Semiarykou
Copy link
Author

[ProjectName.Feature.Product.module.json.txt](https://github.com/blipson89/Leprechaun/files/7244621/ProjectName.Feature.Product.module.json.txt
Leprechaun.config.txt
)
We used plugins to skip such includes but it is not a good fix

@blipson89
Copy link
Owner

Hi @Viktar-Semiarykou - I wanted to give a quick update.

There are actually two issues here:

  1. Since the root of the tree isn't technically present because "descendants only" is set, Sitecore Serialization returns null rather than pass along the children. This is why you're getting the null reference error.
    2 that config you sent me didn't have a templates node, so the expected behaviour is that it should be passed over, not parsed. It looks like the SitecoreTemplatePredicate isn't doing its job correctly.

What I'm planning on doing:

  1. Fix the SitecoreTemplatePredicate to ensure it's only attempting to build templates. This will coincidentally make your specific instance of the error go away, despite it not actually fixing the underlying problem.
  2. Account for scenarios where the root item isn't included.

I should be able to get a fix issued by next week, alongside the other 2 issues you logged and possibly a new feature now that Sitecore CLI 4.0 is out.

I'll keep you posted. Thank you again for reporting these issues.

@blipson89
Copy link
Owner

Hi @Viktar-Semiarykou,

I've pushed up a beta version that should resolve this issue. Can you please do the following:

  1. run dotnet tool update --version 2.1.0-beta0012 leprechaun.cli
  2. Update your Leprechaun.config:
    1. The serializationFormatter type has been updated. Use the value from Leprechaun.config line 108
    2. Look at the latest Leprechaun.config lines 85-89. Please make sure the template predicate include(s) match the appropriate includes in your .module.json. The path no longer matters, but the name needs to match up.

Note: this version of Leprechaun now has /watch functionality too in case you're interested.

@blipson89
Copy link
Owner

Fixed in 2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants