Esm: v3.0.49: TypeError: 'getOwnPropertyDescriptor' on proxy

Created on 13 Jun 2018  路  6Comments  路  Source: standard-things/esm

_sorry, not looking for bugs. was just running some scenarios with: https://github.com/standard-things/esm/issues/468_

esm v3.0.49
node v10.4.0

I'm guessing it's because of the new named exports of 'cjs' build-in modules in node 10? Not sure.

repro

import fs from './foo';
// foo.js
module.exports = require('fs');

or

import fs from 'fs';
export default fs;
TypeError: 'getOwnPropertyDescriptor' on proxy: trap returned descriptor for property 'constants' that is incompatible with the existing property in the proxy target
    at Function.keys (<anonymous>)
    at formatValue (util.js:498:21)
    at inspect (util.js:328:10)
    at formatValue (util.js:467:31)
    at formatProperty (util.js:1051:11)
    at formatObject (util.js:791:17)
    at formatValue (util.js:714:18)
    at inspect (util.js:328:10)
bug needs tests

Most helpful comment

sorry, not looking for bugs. was just running some scenarios with

No, please keep it up. All this stuff helps.

I'm guessing it's because of the new named exports of 'cjs' build-in modules in node 10? Not sure.

Not in this case. In this case it's because I broke a proxy assumption. It seems non-configurable and non-extensible properties must return the same value of the descriptor from a getOwnPropertyDescriptor trap and I was returning a wrapped value.

Update:

v3.0.50 is released :tada:

All 6 comments

sorry, not looking for bugs. was just running some scenarios with

No, please keep it up. All this stuff helps.

I'm guessing it's because of the new named exports of 'cjs' build-in modules in node 10? Not sure.

Not in this case. In this case it's because I broke a proxy assumption. It seems non-configurable and non-extensible properties must return the same value of the descriptor from a getOwnPropertyDescriptor trap and I was returning a wrapped value.

Update:

v3.0.50 is released :tada:

Just updated to 3.1.0 and now I'm getting this error too.

TypeError: 'getOwnPropertyDescriptor' on proxy: trap returned descriptor for property 'arguments' that is incompatible with the existing property in the proxy target                                             
    at /home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1
    at module.exports.$.inited.$.module.utilSilent (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)                                                                                              
    at Object.<anonymous> (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)
    at e (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)
    at module.exports.$.inited.$.module.utilGetProxyDetails (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)                                                                                     
    at module.exports.$.inited.$.module.utilUnwrapProxy (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)                                                                                         
    at Object.<anonymous> (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)
    at r (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)
    at /home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1
    at /home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1
TypeError: Cannot read property 'Script' of undefined
    at Object.<anonymous> (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)
    at Object.<anonymous> (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)
    at Proxy.<anonymous> (/home/ayrton/Documents/ayyo-websocket/node_modules/esm/esm.js:1)
    at Object.onceWrapper (events.js:276:13)
    at process.emit (events.js:193:15)
    at process.EventEmitter.emit (domain.js:441:20)
    at process.topLevelDomainCallback (domain.js:120:23)

hey @FallingSnow

do you have a simple repro for this? generally it's also better to open a new issue for tracking purposes.

Just downgraded to [email protected] for the time being. If I have the time/need I'll come back and try to put a repo together for the issue on 3.1.0.

@FallingSnow although a repro repo would be ideal, it doesn't necessarily need to be one if the repro steps are simple enough.

Was this page helpful?
0 / 5 - 0 ratings