Code: (sdk.js)
const AWS = require("aws-sdk");
AWS.config.apiVersions = {
s3: "2006-03-01"
};
module.exports = async (req, res) => {
var s3 = new AWS.S3();
};
Output:
â–² aws-sdk/ node sdk.js
/Users/rauchg/Projects/now-demos/aws-sdk/sdk.js:1
(function (exports, require, module, __filename, __dirname) { "use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var util=_interopDefault(require("util")),fs=_interopDefault(require("fs")),crypto=_interopDefault(require("crypto")),stream=_interopDefault(require("stream")),dgram=_interopDefault(require("dgram")),os=_interopDefault(require("os")),path=_interopDefault(require("path")),string_decoder=_interopDefault(require("string_decoder")),events=_interopDefault(require("events")),timers=_interopDefault(require("timers")),https=_interopDefault(require("https")),http=_interopDefault(require("http")),buffer=_interopDefault(require("buffer")),domain=_interopDefault(require("domain")),url=_interopDefault(require("url")),querystring=_interopDefault(require("querystring"));function JsonBuilder(){}function translate(e,t){if(t&&null!=e)switch(t.type){case"structure":return translateStructure(e,t);case"map":return translat
TypeError: Cannot read property 'memoizedProperty' of undefined
at Object.<anonymous> (/Users/rauchg/Projects/now-demos/aws-sdk/sdk.js:1:5034)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:308:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
Had a deeper look at this one, and this seems to be a very interesting execution order bug in the commonjs plugin.
Basically, somehow because of the way that the proxy module works, it's not quite executing modules in the right tree order.
This seems like an important bug to fix.
The issue at play here is also ultimately cycles, but it is exacerbated by the following:
index.js
require('./x')();
require('./y');
x.js
module.exports = function () {
require('./y');
}
Because we statically turn x.js into by CJS -> ESM conversion:
import './y';
export default function () {
y;
}
This means that y is now imported and executed earlier in the graph than it would have been.
This makes no difference here, but introduce cycles and it causes real execution ordering differences.
Was this issue resolved? I am getting the same error with the aws-sdk using rollup.js to bundle up my lambda code. Ncc seems like a slightly better fit though, and I'd be willing to switch if this problem was solved.
Most helpful comment
Was this issue resolved? I am getting the same error with the aws-sdk using rollup.js to bundle up my lambda code. Ncc seems like a slightly better fit though, and I'd be willing to switch if this problem was solved.