You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! 👋🏻 First of all, thanks for such a helpful tool. I love running pa11y-ci as a GitHub pull request workflow against a newly-built sitemap on Next.js sites. It helps me catch a lot of the easy stuff and also prevent regressions! 🙌🏻
This brings me to an issue I ran into today. I was trying to add a GitHub workflow I commonly use to a Next.js site, but kept getting the following error:
The sitemap "<url>" could not be parsed
It took a lot of manual debugging for me to figure out what the core issue was. I tried using other CLI options, comparing configuration with other projects I've successfully added my workflow to, and finally tried copy-pasting some of the source code to test locally on my machine. After adding many console.logs to first understand the code and then second to isolate where the error was, I found this node-fetch error was the source of my troubles:
TypeError: Only absolute URLs are supported
After that, I Googled the error message under node-fetch, took another look at my generated sitemap files, and found that the URLs generated did not start with https://. After I added those back in, my workflow was successful! 🎉
Request
Although my quest was successful, it did take somewhere around one hour to debug the problem. I'm confident it would have taken me less than 15 minutes to debug if the TypeError: Only absolute URLs are supported had been visible from the beginning. My proposal is to update the error handling in getUrlsFromSitemap to no longer lose the errors it catches.
functiongetUrlsFromSitemap(sitemapUrl,config){returnPromise.resolve().then(()=>fetch(sitemapUrl)).then((response)=>response.text()).then((body)=>{// cheerio code ...}).catch((error)=>{if(error.stack&&error.stack.includes('node-fetch')){thrownewError(`The sitemap "${sitemapUrl}" could not be loaded`);}thrownewError(`The sitemap "${sitemapUrl}" could not be parsed`);});}
Thank you for the consideration! 💖
The text was updated successfully, but these errors were encountered:
Background
Hello! 👋🏻 First of all, thanks for such a helpful tool. I love running
pa11y-ci
as a GitHub pull request workflow against a newly-built sitemap on Next.js sites. It helps me catch a lot of the easy stuff and also prevent regressions! 🙌🏻This brings me to an issue I ran into today. I was trying to add a GitHub workflow I commonly use to a Next.js site, but kept getting the following error:
The sitemap "<url>" could not be parsed
It took a lot of manual debugging for me to figure out what the core issue was. I tried using other CLI options, comparing configuration with other projects I've successfully added my workflow to, and finally tried copy-pasting some of the source code to test locally on my machine. After adding many
console.log
s to first understand the code and then second to isolate where the error was, I found thisnode-fetch
error was the source of my troubles:After that, I Googled the error message under
node-fetch
, took another look at my generated sitemap files, and found that the URLs generated did not start withhttps://
. After I added those back in, my workflow was successful! 🎉Request
Although my quest was successful, it did take somewhere around one hour to debug the problem. I'm confident it would have taken me less than 15 minutes to debug if the
TypeError: Only absolute URLs are supported
had been visible from the beginning. My proposal is to update the error handling ingetUrlsFromSitemap
to no longer lose the errors it catches.These are the lines in particular: https://github.com/pa11y/pa11y-ci/blob/master/bin/pa11y-ci.js#L253-L258
Thank you for the consideration! 💖
The text was updated successfully, but these errors were encountered: