Lighthouse Error: LHR failed to render in Angular SSR - angular-universal

I am trying to run a lighthouse performance audit on an Angular SSR yet it returns an empty page. No error messages or anything.
However, if I run it on https://pagespeed.web.dev/ it says Core Web Vitals Assessment: Failed and Error: LHR failed to render. But it does show me the data from the previews 28 days.
If I run the lighthouse CLI I am able to get the JSON report but it will also not render an HTML version and does not seem to show any errors.
"lighthouse https://daomaker.com --output=json --output-path=./report.json --save-assets --only-categories=performance"
It returns 3 files, report-0.devtoolslog.json report-0.trace.json report.json
If I open the empty HTML tab and look at the HTML I get this console error:
compiled-reportrenderer.js:92 Uncaught TypeError: Cannot read properties of null (reading 'toString')
at Function.render (compiled-reportrenderer.js:92:2125)
at z.renderNode (compiled-reportrenderer.js:108:6424)
at z._renderTableValue (compiled-reportrenderer.js:108:2467)
at z._renderTableRow (compiled-reportrenderer.js:108:4484)
at z._renderTableRowsFromItem (compiled-reportrenderer.js:108:4755)
at z._renderTable (compiled-reportrenderer.js:108:5510)
at z.render (compiled-reportrenderer.js:108:266)
at F.populateAuditValues (compiled-reportrenderer.js:66:1478)
at F.renderAudit (compiled-reportrenderer.js:66:357)
at compiled-reportrenderer.js:129:4656
Which seems to relate to this line of code:
function A(e,t,n){return e<t?t:e>n?n:e}class C{static getScreenshotPositions(e,t,n){const r={x:(i=e).left+i.width/2,y:i.top+i.height/2};var i;const o=A(r.x-t.width/2,0,n.width-t.width),a=A(r.y-t.height/2,0,n.height-t.height);return{screenshot:{left:o,top:a},clip:{left:e.left-o,top:e.top-a}}}static renderClipPathInScreenshot(e,t,n,r,i){const o=e.find("clipPath",t),a=`clip-${l.getUniqueSuffix()}`;o.id=a,t.style.clipPath=`url(#${a})`;const s=n.top/i.height,c=s+r.height/i.height,d=n.left/i.width,h=d+r.width/i.width,p=[`0,0 1,0 1,${s} 0,${s}`,`0,${c} 1,${c} 1,1 0,1`,`0,${s} ${d},${s} ${d},${c} 0,${c}`,`${h},${s} 1,${s} 1,${c} ${h},${c}`];for(const t of p){const n=e.createElementNS("http://www.w3.org/2000/svg","polygon");n.setAttribute("points",t),o.append(n)}}static installFullPageScreenshot(e,t){e.style.setProperty("--element-screenshot-url",`url(${t.data})`)}static installOverlayFeature(e){const{dom:t,reportEl:n,overlayContainerEl:r,fullPageScreenshot:i}=e,o="lh-screenshot-overlay--enabled";n.classList.contains(o)||(n.classList.add(o),n.addEventListener("click",(e=>{const n=e.target;if(!n)return;const o=n.closest(".lh-node > .lh-element-screenshot");if(!o)return;const a=t.createElement("div","lh-element-screenshot__overlay");r.append(a);const l={width:.95*a.clientWidth,height:.8*a.clientHeight},s={width:Number(o.dataset.rectWidth),height:Number(o.dataset.rectHeight),left:Number(o.dataset.rectLeft),right:Number(o.dataset.rectLeft)+Number(o.dataset.rectWidth),top:Number(o.dataset.rectTop),bottom:Number(o.dataset.rectTop)+Number(o.dataset.rectHeight)},c=C.render(t,i.screenshot,s,l);c?(a.appendChild(c),a.addEventListener("click",(()=>a.remove()))):a.remove()})))}static _computeZoomFactor(e,t){const n={x:t.width/e.width,y:t.height/e.height},r=.75*Math.min(n.x,n.y);return Math.min(1,r)}static render(e,t,n,r){if(!function(e,t){return t.left<=e.width&&0<=t.right&&t.top<=e.height&&0<=t.bottom}(t,n))return null;const i=e.createComponent("elementScreenshot"),o=e.find("div.lh-element-screenshot",i);o.dataset.rectWidth=n.width.toString(),o.dataset.rectHeight=n.height.toString(),o.dataset.rectLeft=n.left.toString(),o.dataset.rectTop=n.top.toString();const a=this._computeZoomFactor(n,r),l={width:r.width/a,height:r.height/a};l.width=Math.min(t.width,l.width);const s=l.width*a,c=l.height*a,d=C.getScreenshotPositions(n,l,{width:t.width,height:t.height});e.find("div.lh-element-screenshot__content",o).style.top=`-${c}px`;const h=e.find("div.lh-element-screenshot__image",o);h.style.width=s+"px",h.style.height=c+"px",h.style.backgroundPositionY=-d.screenshot.top*a+"px",h.style.backgroundPositionX=-d.screenshot.left*a+"px",h.style.backgroundSize=`${t.width*a}px ${t.height*a}px`;const p=e.find("div.lh-element-screenshot__element-marker",o);p.style.width=n.width*a+"px",p.style.height=n.height*a+"px",p.style.left=d.clip.left*a+"px",p.style.top=d.clip.top*a+"px";const u=e.find("div.lh-element-screenshot__mask",o);return u.style.width=s+"px",u.style.height=c+"px",C.renderClipPathInScreenshot(e,u,d.clip,n,l),o}}
Meaning is probably related to the screenshots.
The bug persist even if I add --screenEmulation.disabled --throttling-method=provided --no-emulatedUserAgent
How do I find the bug stopping the lighthouse from returning an HTML report?

Related

what might be the reason for selenium working for xpath sometimes but sometimes fail to identify the xpath?

def linkdin_login(company_name,username,password):
driver.get('https://linkedin.com/')
driver.find_element(By.XPATH,'//*[#id="session_key"]').send_keys(username)
driver.find_element(By.XPATH,'//*[#id="session_password"]').send_keys(password)
driver.find_element(By.XPATH,"//button[#class='sign-in-form__submit-button']").click()
#def company_info(company_name):
element = driver.find_element(By.CSS_SELECTOR,"#global-nav-typeahead > input")
element.send_keys(company_name)
element.send_keys(Keys.ENTER)
driver.implicitly_wait(10) # seconds
driver.get(driver.find_element(By.CSS_SELECTOR,".search-nec__hero-kcard-v2 > a:nth-child(1)").get_attribute("href"))
driver.implicitly_wait(10)
people()
by the above code i am logging into LinkedIn and fetching the LinkedIn page of the some companies after getting the page I am trying to get the employee data by using people function show below
def people():
driver.implicitly_wait(10)
driver.get(driver.find_element(By.XPATH,"/html/body/div[5]/div[3]/div/div[2]/div/div[2]/main/div[1]/section/div/div[2]/div[1]/div[2]/div/a").get_attribute("href"))
driver.implicitly_wait(10)
people = driver.find_element(By.XPATH,"/html/body/div[4]/div[3]/div[2]/div/div[1]/main/div/div/div[2]/div/ul")
people_data = people.find_elements(By.TAG_NAME,"li")
for i in people_data:
print(i.text)
in this function i am trying to access the link to employees data
that is where the problem lies
the line 2 of people function i trying to get the link the problem is due to some reason sometimes i am getting the link(not to frequently!!) but most of the time i am getting the error saying Xpath not found
i didn't know how to attach a html page so i am attaching the link
([https://www.linkedin.com/company/google/](https://www.stackoverflow.com/)
1. I tried implicit wait assuming that the program is trying to access the Xpath during loading of the page

Issues when uploading data to Google Alerts

I am trying to upload a list of companies to Google Alerts, but getting this error:
CasperError: Errors encountered while filling form: Unable to find field element in form: FieldNotFound: setField: Invalid field ; only HTMLElement is supported
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:837 in fillForm
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:930 in fillSelectors
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/code/galerts.js:229
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:1637 in runStep
/Users/sam/Documents/Work/google-alerts-export-import/phantomjs:/platform/casper.js:414 in checkStep
Here's the sample.csv file data:
Apple;At most once a week;Blogs;English;Argentina;All results;RSS feed
And I run it as:
casperjs galerts.js import --file=sample.csv --delete-others
Here's the Github for the program:
https://github.com/jra11/google-alerts-export-import
This happens due to mismatch in versions of library, downgrade casper.

MEAN stack Service Workers

I am using the MEAN stack using the Google's read-through-caching example.
Everytime I load or refresh, the error is
Uncaught (in promise) TypeError: Cannot set property 'textContent' of null(…)
in (the following code, line 112 ).
I changed the class from #status to #ng-scope to meet the main class to cache
document.querySelector('#ng-scope').textContent = error;
HTML file modification relative to the class it needs to cache
It still works but it's showing the error in red. I tried other solutions evaluating if the value is null but no luck or I am probably doing it wrong.

HtmlUnit thorw error "define is not defined"

I tried to load simple page using HTMLUnit it is throwing below error
Enclosed exception:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "define" is not defined.
I think this is problem because of ECMA6 ? But I am not able to find any way to resolve
My first attempt would be to ignore all javascript related Exceptions because on most web sites the interesting parts work even if some of the javascript is not executed.
webClient.getOptions().setThrowExceptionOnScriptError(false); // we never want Exceptions because of javascript
Some other properties which are often useful (not directly related to your problem) are:
webClient.setJavaScriptTimeout(30000); // limit to e.g.30s
webClient.getOptions().setTimeout(300000); // timeout to e.g. 300s = 5min
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setPopupBlockerEnabled(true);
webClient.setRefreshHandler(new WaitingRefreshHandler(...)); // limit the time for refreshes

Dojo SyntaxError: missing ) in parenthetical

I have had this same error before and posted a question to that effect but unfortunately there was no answer. The previous error occurred under different circumstances ( ie I was triggered when I used the dojo toolkit sdk(Size 19M).
This time I am retrieving data from a couple of tables which have a one to many relationship. I am using Dojo, Doctrine and Zend Framework for my project. I have posted quite an extensive error message at 1 the Link to pastie.org with code and error details and the php and javascript that I identified as being the code involved.
When you look towards the end of the pastie in the FIREBUG ERROR MESSAGE section you will see a piece of JSON like
[{"id":"000001",
"name":"Adam",
"area_id":null,
"registration_date":"2011-03-08",
"loan_cycle":"0","credit_score":"100",
"created_by":null,
"borrowers":[{"id":"00000001",
"first_name":"Test",
"surname":"User",
"dob":"2006-12-09",
"personalid_no":"100000",
"gender":"Male",
"marital_status":"Marrie",
"home_number":"09866678",
"mobile_number":"09877655",
"accomodation_type":"owner",
"current_loan_cycle":"1",
"status":"Active",
"date_created":null,
"date_registered":"2009-12-11",
"created_by":null,
"Groups_id":"000001"}]
}]
Its clear that the data gets pulled from the tables. However the code fails and I get the error message SyntaxError: missing ) in parenthetical. I have battled with this for a long time now. Am at a point where I either have to abandon the application or restart the whole project again. Thanks for your help.

Resources