jekyll serve ERROR `/sw.js' not found - jekyll

I get the following error after using jekyll serve
[2018-07-06 09:42:43] INFO WEBrick::HTTPServer#start: pid=7146 port=4000
Server running... press ctrl-c to stop.
[2018-07-06 09:43:03] DEBUG accept: 127.0.0.1:45172
[2018-07-06 09:43:03] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2018-07-06 09:43:03] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2018-07-06 09:43:03] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2018-07-06 09:43:04] DEBUG Jekyll::Commands::Serve::Servlet is invoked.
[2018-07-06 09:43:04] ERROR `/sw.js' not found.
[2018-07-06 09:43:04] DEBUG close: 127.0.0.1:45172
The error occurs every time I reload the page in the Firefox browser, not during build.
Where does that come from? I couldn't find any file in my project directory that contains sw.js
I use the minima theme

The sw.js file can be anything :) but I've seen this file created automatically by the REACT framework. It includes some caching information and the name is short for service worker.
The easiest way to avoid this error os to check where this file should be found using your browser's console and then create it in that location.
However, I assume that your theme needs this file, generally through a node_modul and you should see how to avoid needing it and thus fix this issue permanently.

Related

Headless Chrome command line - set timeout

I'm trying to print pdf from Gmail with headless chrome in command line.
I cannot install pupeteer or another tool with the computer that script will run on, due to unability to install anything.
For simple gsuite pages such as https://myaccount.google.com/, my script runs perfectly.
For more complex ones such as gmail, the output PDF I get shows a partially loaded page:
output PDF
I'm already using the --run-all-compositor-stages-before-draw option which should wait for the page to resolve before printing.
I've tried to add --virtual-time-budget=10000 just before --run-all-compositor-stages-before-draw, however if I ask for more than 2000 milliseconds the command runs for ever without producing the output pdf.
See my code so far below (which I put in a .bat file)
Does anyone have encountered that issue ? Any lead on how to solve it ? Any ways to first load the page, then have a timeout command, then print to pdf ?
I couldn't find a solution so far on the web.
Thanks :)
Ps: english isn't my primary language, please excuse any mistake
#set outputFile=C:\Users\MyUserName\Temp\testPDFprintChromeheadless\test.pdf
#set chromeDirectory=C:\Program Files (x86)\Google\Chrome\Application
#set url=https://mail.google.com/mail/
#set userData=C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data
#set profile=MyChromeProfile
#set useragentChrome="Mozilla/5.0 (X11\\; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36"
#cd "%chromeDirectory%"
chrome.exe --headless --disable-gpu --profile-directory="%profile%" --user-data-dir="%userData%" --user-agent=%useragentChrome% --run-all-compositor-stages-before-draw --print-to-pdf="%outputFile%" --print-to-pdf-no-header "%url%"
pause
Edit :
Here are the logs I get.
AccÞs refusÚ means Accès refusé which is french for Access denied.
I don't have administrator rights on this computer, thus not able to write within the Chrome directory, that could explain this access denied.
[0820/101506.995:ERROR:cache_util_win.cc(20)] Unable to move the cache: AccÞs refusÚ. (0x5)
[0820/101506.996:ERROR:cache_util.cc(144)] Unable to move cache folder C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\GPUCache to C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\old_GPUCache_000
[0820/101506.997:ERROR:disk_cache.cc(184)] Unable to create cache
[0820/101506.997:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2
[0820/101509.033:ERROR:cache_util_win.cc(20)] Unable to move the cache: AccÞs refusÚ. (0x5)
[0820/101509.034:ERROR:cache_util.cc(144)] Unable to move cache folder C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\Cache to C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\old_Cache_000
[0820/101509.035:ERROR:disk_cache.cc(184)] Unable to create cache
[0820/101510.020:ERROR:service_worker_storage.cc(1899)] Failed to delete the database: Database IO error
[0820/101513.168:INFO:CONSOLE(1763)] "Deprecated API for given entry type.", source: https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.fr.YnGL5qwRpj4.O/am=rvxfykdgoP_swM-GUSAcAAM5SAABYIUsYuW09wdKmv8BAwAGoG_F8GAQrnkAdJzCuAQAAAAAAAAAAAAAAAAAAADsAisGAQ/d=1/exm=b/ed=1/im=1/dg=0/br=1/wt=1/rs=AHGWq9AzRZEBJ1Ek7NOabODYvaA7PPmCUQ/cb=loaded_1/m=a (1763)
[0820/101519.465:INFO:headless_shell.cc(648)] Written to file C:\Users\MyUserName\Temp\testPDFprintChromeheadless\test.pdf.

AWS Amplify: DevTools failed to load SourceMap: Unexpected token < in JSON at position 0

I am getting several warnings when loading my website on Google Chrome similar to the following:
DevTools failed to load SourceMap: Could not parse content for https://mywebsite.com/static/js/2.abcd1234.chunk.js.map: Unexpected token < in JSON at position 0
My webapp is a React application (create-react-app) deployed on AWS Amplify. I do not get these warnings when running the app locally. How do I get rid of these warnings?
This is a problem caused by using react-router with AWS amplify. See this github issue. It suggests adding the following entry in the Rewrites and redirects section of App settings in AWS Amplify:
Source address:
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/>
Target address:
/index.html
Type:
200 (Rewrite)
To solve my problem, I added the map extension to this regex:
Source address:
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map)$)([^.]+$)/>
I checked my Rewrites and redirects settings and it was already configured as per the below answer by "roob" but also had json at the end. I removed it to see if that helped. Either way, I still got the error.
More research with a colleague and found another root cause. Answered here:
AWS Amplify error: Failed to parse source map... file: Error: ENOENT: no such file or directory

ERROR `/' not found. ERROR `/blog/assets/main.css' not found.

Noob here. Recently setup jekyll with github pages and the site is functioning on the github server however, since i pushed to github I am now having problems when I enter jekyll serve in to the shell and make any changes in my blog posts md files. The following message appears in the command line and a 404 page not found on my local server... All I did was add some content to one of my posts.. Didn't change any front matter either, have since undone any changes and still i get the same error...
tim#ubuntu16:~/github/blog$ jekyll serve
Configuration file: /home/tim/github/blog/_config.yml
Source: /home/tim/github/blog
Destination: /home/tim/github/blog/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.199 seconds.
Auto-regeneration: enabled for '/home/tim/github/blog'
Server address: http://127.0.0.1:4000blog/
Server running... press ctrl-c to stop.
[2018-04-08 21:56:21] ERROR/' not found.
[2018-04-08 21:56:21] ERROR /blog/assets/main.css' not found.
[2018-04-08 21:56:21] ERROR/blog/assets/minima-social-icons.svg' not found.
`
`
This is where it breaks : "Server address: http://127.0.0.1:4000blog/"
In _config.yml, set baseurl: /blog

Jekyll bad uri bad request line

For some reason I started getting this error and I'm not sure why. I haven't been doing anything differently, it just started doing this. Does anyone know why this would be happening?
Bryans-MacBook-Pro:website bryan$ bundle exec jekyll serve
Configuration file: /Users/bryan/Dropbox/Websites/Clients/website/_config.yml
Configuration file: /Users/bryan/Dropbox/Websites/Clients/website/_config.yml
Source: /Users/bryan/Dropbox/Websites/Clients/website
Destination: /Users/bryan/Dropbox/Websites/Clients/website/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.114 seconds.
Auto-regeneration: enabled for '/Users/bryan/Dropbox/Websites/Clients/website'
Configuration file: /Users/bryan/Dropbox/Websites/Clients/website/_config.yml
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
[2017-10-31 11:06:45] ERROR bad URI `d??\x1EG?7?\x16??\x06???\x16????\\,?\x01\b?oq?K\x00\x00(?,?+?$?#?'.
[2017-10-31 11:06:50] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03\x14?????.?z?m??\x02®?,??("p?M%?'\x17?N\x00\x00.?,?+?$?#?'.
[2017-10-31 11:06:50] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x01????ۙ\x10o?/?\\????k?<r\x18ofGL>`\x02?Ć\v\x00\x00\x12\x00/\x003\x005\x009?\t?'.
If you are receiving this answer it is because your browser is trying to load the page via https and not http

Why does SimpleHTTP2Server fail to load service worker on localhost

When I try to run the Polymer Shop locally, both the bundled and unbundled builds, using the SimpleHTTP2Server , on my local host using port 5000, the request for service-worker.js fails:
An SSL certificate error occurred when fetching the script.
https://localhost:5000/service-worker.js Failed to load resource: net::ERR_INSECURE_RESPONSE
(index):1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script.
Is there an easy way to get this to work? I tried a number of start up flags, like:
chrome.exe --ignore-certificate-errors --incognito
--unsafely-treat-insecure-origin-as-secure --allow-insecure-localhost
but that didn't help, I still get:
(index):1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script.
Following alesc's suggestion, I found instructions here:
These are instructions for Chrome 55 on Windows 10. It seems these steps may change frequently.
On the page with the untrusted certificate (https:// is crossed out in red), click the lock so a popup opens up.
Click the Details link under the information section at the top.
Click on the View Certificate button.
Click on the Details tab
Click on the Copy to File
Click Next
Export as PKCS #7
Open up Chrome Settings > Show advanced settings > HTTPS/SSL > Manage Certificates
Import the certificate created in step 7 to both the Intermediate Certificate Authorities tab as well as the Trusted Authorities Tab.
Restart Chrome and open your localhost site.