[MGNLCT-265] Provision workspace by enabling auto create has not taken into account for others environments Created: 09/Aug/22  Updated: 09/Feb/23  Resolved: 30/Sep/22

Status: Closed
Project: Content Types
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0

Type: Bug Priority: Critical
Reporter: Andrei Ichimescu Assignee: Oanh Thai Hoang
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 7d 0.5h Time Spent: 7d 0.5h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: PNG File error003145.png     PNG File evn_tables.png     PNG File query.png    
Issue Links:
dependency
is depended upon by PAGES-771 [SaaS] Provision website workspace an... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLCT-274 Implement Sub-task Completed Oanh Thai Hoang  
MGNLCT-275 Test in staging Sub-task Completed Oanh Thai Hoang  
MGNLCT-276 Review Sub-task Completed Rabie Hayoun  
MGNLCT-277 piQA Sub-task Completed Dai Ha  
MGNLCT-278 QA Sub-task Completed Dai Ha  
MGNLCT-298 Check problem why don't have default env Sub-task Completed Oanh Thai Hoang  
MGNLCT-300 There is still one problem that envs ... Sub-task Completed Oanh Thai Hoang  
MGNLCT-301 rv + piQA again Sub-task Completed Chuong Doan Huy  
MGNLCT-302 QA again Sub-task Closed Rishab Dhar  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[X]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: SaaS TPR - ContentTypes
Sprint: DevX 17, DevX 18, DevX 19, DevX 20
Story Points: 5
Team: DeveloperX

 Description   

There is 1 problem when using the auto-create functionality of MGNLCT-215

Below is 1 example of content type that enable provisioning workspace path:

 

datasource:
  $type: norsuContentTypeDatasource
  workspace: website
  autoCreate: true 

Step to reproduce:

  • Add above file to ccontentTypes folder below any light modules
  • Observe new path "website" has been created. You can go to Content App and see website record
  • Go to database and query the new record. Ex: SELECT * FROM norsu.nodes
    where text_path ='/website'
  • See it stored only in draft env. See image, column env_id = 1. 1 is draft env


 Comments   
Comment by Oanh Thai Hoang [ 17/Aug/22 ]

A hint from Rabie:

 

Right now, we are not taking in account any environment that are not the default ones(see https://git.magnolia-cms.com/projects/CLOUD/repos/norsu/browse/magnolia-norsu/src/main/java/info/magnolia/norsu/CurrentEnvironmentContextProvider.java#64) we need to integrate this with devx environment (@David could you add a story). Let see some use cases:
1. Public instance
	- Should not try to create an environment, the call will fail because public instance just have read access.
2. Author instance
	a. Default environments (main, draft)
		- Author instance has access to "draft" environement by default. So any action runned on author instance on the default devx environment will be runned for norsu "draft" environment, that why we don't see the new rootPath on main
		- Possible solution:
			1. If you are working on the default environment and author, publish the newly created node to main.
			2. Automatically run the functionality for "main" and "draft" as we do here https://git.magnolia-cms.com/projects/MODULES/repos/content-types/browse/magnolia-content-types/src/main/java/info/magnolia/types/ContentTypesModule.java#80
	b. Others (when magnolia start up or there is a releoad event, basically not in a request)
		- the rootpath logic should be wrapped in something like this https://git.magnolia-cms.com/projects/MODULES/repos/content-types/browse/magnolia-content-types/src/main/java/info/magnolia/types/ContentTypesModule.java#80, so the right environment is picked up automatically and used to run action. (@nucleus need to make the change on CurrentEnvironmentContextProvider) 
Comment by Oanh Thai Hoang [ 08/Sep/22 ]

Reverted PR due to 

Caused by: java.lang.RuntimeException: No default environment found for subscription
	at info.magnolia.norsu.environment.CurrentEnvironmentContextProvider.lambda$new$0(CurrentEnvironmentContextProvider.java:73)
	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
	at info.magnolia.norsu.environment.CurrentEnvironmentContextProvider.<init>(CurrentEnvironmentContextProvider.java:73)
	at info.magnolia.norsu.environment.CurrentEnvironmentContextProvider$$FastClassByGuice$$acabf592.newInstance(<generated>)
	at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
	at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
	at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
	at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
	at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213)
	at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184) 
Comment by Oanh Thai Hoang [ 28/Sep/22 ]

Flag added

depend on https://jira.magnolia-cms.com/browse/CLOUD-2020

Comment by Oanh Thai Hoang [ 29/Sep/22 ]

After https://jira.magnolia-cms.com/browse/CLOUD-2020 has been fixed and rest norsu can instanced successfully. The error writer from missing jackson provider to write mesage as json still happen and it prevents Content type to create a new rootPath. See problem

Generated at Mon Feb 12 00:38:40 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.