Skip to content

Commit

Permalink
Add logging for failed dev dep requests (#9638)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcompiles authored Apr 15, 2024
1 parent 2df56ed commit 179f63a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 14 additions & 1 deletion packages/core/core/src/RequestTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@ export default class RequestTracker {
request: Request<TInput, TResult>,
opts?: ?RunRequestOpts,
): Promise<TResult> {
let requestId = this.graph.hasContentKey(request.id)
let hasKey = this.graph.hasContentKey(request.id);
let requestId = hasKey
? this.graph.getNodeIdByContentKey(request.id)
: undefined;
let hasValidResult = requestId != null && this.hasValidResult(requestId);
Expand Down Expand Up @@ -1224,6 +1225,18 @@ export default class RequestTracker {
deferred.resolve(true);
return result;
} catch (err) {
if (request.type === requestTypes.dev_dep_request) {
logger.verbose({
origin: '@parcel/core',
message: `Failed DevDepRequest`,
meta: {
trackableEvent: 'failed_dev_dep_request',
hasKey,
hasValidResult,
},
});
}

this.rejectRequest(requestNodeId);
deferred.resolve(false);
throw err;
Expand Down
6 changes: 5 additions & 1 deletion packages/core/core/src/requests/DevDepRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,17 @@ export async function runDevDepRequest<TResult>(
id: 'dev_dep_request:' + devDepRequest.specifier + ':' + devDepRequest.hash,
type: requestTypes.dev_dep_request,
run: ({api}) => {
for (let filePath of nullthrows(devDepRequest.invalidateOnFileChange)) {
for (let filePath of nullthrows(
devDepRequest.invalidateOnFileChange,
'DevDepRequest missing invalidateOnFileChange',
)) {
api.invalidateOnFileUpdate(filePath);
api.invalidateOnFileDelete(filePath);
}

for (let invalidation of nullthrows(
devDepRequest.invalidateOnFileCreate,
'DevDepRequest missing invalidateOnFileCreate',
)) {
api.invalidateOnFileCreate(invalidation);
}
Expand Down

0 comments on commit 179f63a

Please sign in to comment.