diff --git a/.changeset/wise-ads-roll.md b/.changeset/wise-ads-roll.md new file mode 100644 index 00000000000..20679dddba8 --- /dev/null +++ b/.changeset/wise-ads-roll.md @@ -0,0 +1,5 @@ +--- +'@whatwg-node/server': patch +--- + +Fix descriptor issue when .fetch is used with dummy context diff --git a/packages/server/src/utils.ts b/packages/server/src/utils.ts index 2fe12579270..240bf72e156 100644 --- a/packages/server/src/utils.ts +++ b/packages/server/src/utils.ts @@ -409,7 +409,10 @@ export function completeAssign(...args: any[]) { // modified Object.keys to Object.getOwnPropertyNames // because Object.keys only returns enumerable properties const descriptors: any = Object.getOwnPropertyNames(source).reduce((descriptors: any, key) => { - descriptors[key] = Object.getOwnPropertyDescriptor(source, key); + const descriptor = Object.getOwnPropertyDescriptor(source, key); + if (descriptor) { + descriptors[key] = Object.getOwnPropertyDescriptor(source, key); + } return descriptors; }, {});