Reputation: 144
EDIT: I have fixed the problem - see my answer below
I have an app (flyxc.app) that has been deployed for a few months without any issues.
I tried to deploy the app again yesterday and get errors:
Uncaught SyntaxError: Invalid or unexpected token
from parsing my js.
This is because the JS looks like:
[q*u�Md�m��0�yw������N�綥4q
rG7��yt�i���@UU�1�.P�\���~�Z��n>N�H'Y0L�t�s������㞰*�
�T&�i��>�-o���T�1���'`�7uǀ�v��!/z}���aC����C�<���}����"� XԼ�g�ӳ�rl-ZU���-Z��*)rA�u�8v*�>l��>!���mHCu�6��Vt��8H� tH��?
jC_����W7_e��7'��z��8R��u�t~)����w\�ƭ�"*�}���ľ�O�b~U����f��+w8rS0$]f��U�˲�2To5.�Gb;�_����~m�z�f
...
By looking at the size of the JS, it seems that it is gzip encoded however the response headers do not contain the content-encoding header:
alt-svc: h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
cache-control: max-age=0
content-length: 72212
content-type: application/javascript; charset=utf-8
date: Sun, 31 May 2020 15:11:57 GMT
last-modified: Tue, 01 Jan 1980 00:00:01 GMT
server: Google Frontend
status: 200
vary: Accept-Encoding
x-cloud-trace-context: c0f4c28a3d84fdb29a8d7caf0d1bbf83;o=1
I did install the ModHeader chrome extension to remove the accept-encoding
header from the request.
Removing the header force the server not zip the response and give the expected payload:
function e(e,t,i,o){var r,s=arguments.length,n=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n}function t(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}const i=new WeakMap,o=e=>(...t)=>{const o=e(...t);return i.set(o,!0),o},r=e=>"function"==typeof e&&i.has(e),s="undefined"!=typeof window&&null!=window.customElements&&void 0!==window...
The JS is served directly by the servers. Here is my app.yml:
runtime: nodejs12
instance_class: F1
automatic_scaling:
max_concurrent_requests: 80
target_cpu_utilization: 0.9
handlers:
- url: /.*
secure: always
redirect_http_response_code: 301
script: auto
Because there seems to be no way to control this header on the app engine side, I suspect a problem on the app engine side.
Could someone help ?
Upvotes: 1
Views: 216
Reputation: 144
I have fixed the problem.
The JS was actually served by a Koa JS server. The Koa server used to compress the JS.
In the end the JS was double gzipped.
I have removed the compression in the Koa server and now everything works fine.
Note: I still do not exactly understand why I worked for 6 months before starting to fail on May 31 - the compression is the Koa server has been here for the last 6 months.
Upvotes: 1