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
Looks like a case was missed as part of #629 / #760 but it seems if a request comes in with 'Content-Type: application/json' the project breaks with an error on the request.
% yarn develop
yarn run v1.22.5
$ greenwood develop
-------------------------------------------------------
Welcome to Greenwood (v0.24.0) ♻️
-------------------------------------------------------
Running Greenwood with the develop command.
Initializing project config
Initializing project workspace contexts
Generating graph of workspace files...
building from local sources...
Started local development server at localhost:1984
Unable to look up greenwood-starter-presentation using NodeJS require.resolve.
Unable to look up greenwood-starter-presentation using NodeJS require.resolve.
Unable to look up greenwood-starter-presentation using NodeJS require.resolve.
Unable to look up greenwood-starter-presentation using NodeJS require.resolve.
TypeError: inputString.charCodeAt is not a function
at hashString (file:///Users/owenbuckley/Workspace/github/repos/greenwood-starter-presentation/node_modules/@greenwood/cli/src/lib/hashing-utils.js:6:40)
at file:///Users/owenbuckley/Workspace/github/repos/greenwood-starter-presentation/node_modules/@greenwood/cli/src/lifecycles/serve.js:141:26
at dispatch (/Users/owenbuckley/Workspace/github/repos/greenwood-starter-presentation/node_modules/koa-compose/index.js:42:32)
at file:///Users/owenbuckley/Workspace/github/repos/greenwood-starter-presentation/node_modules/@greenwood/cli/src/lifecycles/serve.js:125:11
at async file:///Users/owenbuckley/Workspace/github/repos/greenwood-starter-presentation/node_modules/@greenwood/cli/src/lifecycles/serve.js:88:5
at async file:///Users/owenbuckley/Workspace/github/repos/greenwood-starter-presentation/node_modules/@greenwood/cli/src/lifecycles/serve.js:51:5
Details
Seems to be because this logic passes body right to the hashing function
But in the case of JSON, body is an Array, which means it wont have a charAt method since it is not a string. A quick test shows this simple check can solve it.
thescientist13
changed the title
fetching JSON content (e.g. _graph.json_) is breaking local dev E-Tag caching mechanism
fetching JSON content (e.g. _graph.json_) or 404 files are breaking local dev E-Tag caching mechanism
Mar 12, 2022
Found another edge case, like with TypeScript sourcemaps which are currently not working, so have an empty body and should be excluded from trying to be E-Tag cached.
Type of Change
Summary
Looks like a case was missed as part of #629 / #760 but it seems if a request comes in with
'Content-Type: application/json'
the project breaks with an error on the request.Details
Seems to be because this logic passes
body
right to the hashing functionBut in the case of JSON,
body
is an Array, which means it wont have acharAt
method since it is not a string. A quick test shows this simple check can solve it.Should probably add a test or figure out how to test for it.
The text was updated successfully, but these errors were encountered: