Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

All the sample as lucky why not together? Has been given #193

Closed
@wspnet

Description

@wspnet

All the sample as lucky why not together? Has been given, What I done wrong?

http://localhost:3558/resize/1796658309.jpg?maxWidth=784&maxHeight=764

`
An unhandled exception occurred while processing the request.
Exception: Call to Node module failed with error: TypeError: func.apply is not a function
at C:\Users\weisp\AppData\Local\Temp\tmpC157.tmp:108:19
at IncomingMessage. (C:\Users\weisp\AppData\Local\Temp\tmpC157.tmp:127:35)
at emitNone (events.js:67:13)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:921:12)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
MoveNext

Stack Query Cookies Headers
Exception: Call to Node module failed with error: TypeError: func.apply is not a function at C:\Users\weisp\AppData\Local\Temp\tmpC157.tmp:108:19 at IncomingMessage. (C:\Users\weisp\AppData\Local\Temp\tmpC157.tmp:127:35) at emitNone (events.js:67:13) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:921:12) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17)
MoveNext
ThrowForNonSuccess
HandleNonSuccessAndDebuggerNotification
GetResult
MoveNext
ThrowForNonSuccess
HandleNonSuccessAndDebuggerNotification
GetResult
MoveNext
ThrowForNonSuccess
HandleNonSuccessAndDebuggerNotification
GetResult
MoveNext in ResizeImageController.cs
var imageStream = await _nodeServices.InvokeAsync( ...

`

System.Exception: Call to Node module failed with error: TypeError: func.apply is not a function at C:\Users\weisp\AppData\Local\Temp\tmpC157.tmp:108:19 at IncomingMessage.<anonymous> (C:\Users\weisp\AppData\Local\Temp\tmpC157.tmp:127:35) at emitNone (events.js:67:13) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:921:12) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17) at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__71.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__91.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__91.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Resize.Controllers.ResizeImageController.<Index>d__5.MoveNext() in E:\Resize\src\Resize\Controllers\ResizeImageController.cs:line 53 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionFilterAsync>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Web.BrowserLink.Runtime.BrowserLinkMiddleware.<ExecuteWithFilter>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__6.MoveNext()

tmpC157
`(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /_/ (function(modules) { // webpackBootstrap
/_
_/ // The module cache
/
_**/ var installedModules = {};

/_/ // The require function
/_
/ function webpack_require(moduleId) {

/_/ // Check if module is in cache
/_
_/ if(installedModules[moduleId])
/
_**/ return installedModules[moduleId].exports;

/_/ // Create a new module (and put it into the cache)
/_
_/ var module = installedModules[moduleId] = {
/
__/ exports: {},
/
__/ id: moduleId,
/
__/ loaded: false
/
_**/ };

/_/ // Execute the module function
/_
/ modules[moduleId].call(module.exports, module, module.exports, webpack_require);

/_/ // Flag the module as loaded
/_
/ module.loaded = true;

/_/ // Return the exports of the module
/_
_/ return module.exports;
/
_**/ }

/_/ // expose the modules object (webpack_modules)
/_
/ webpack_require.m = modules;

/_/ // expose the module cache
/_
/ webpack_require.c = installedModules;

/_/ // webpack_public_path
/_
/ webpack_require.p = "";

/_/ // Load entry module and return exports
/_
_/ return webpack_require(0);
/
__/ })
/
_*************************************************************_/
/_/ ([
/
0 /
/
/ function(module, exports, webpack_require) {

module.exports = __webpack_require__(1);

// },
/
1 /
/
/ function(module, exports, webpack_require) {

"use strict";
// Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
// but simplifies things for the consumer of this module.
var http = __webpack_require__(2);
var path = __webpack_require__(3);
var ArgsUtil_1 = __webpack_require__(4);
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
// reference to Node's runtime 'require' function.
var dynamicRequire = eval('require');
var server = http.createServer(function (req, res) {
    readRequestBodyAsJson(req, function (bodyJson) {
        var hasSentResult = false;
        var callback = function (errorValue, successValue) {
            if (!hasSentResult) {
                hasSentResult = true;
                if (errorValue) {
                    res.statusCode = 500;
                    if (errorValue.stack) {
                        res.end(errorValue.stack);
                    }
                    else {
                        res.end(errorValue.toString());
                    }
                }
                else if (typeof successValue !== 'string') {
                    // Arbitrary object/number/etc - JSON-serialize it
                    res.setHeader('Content-Type', 'application/json');
                    res.end(JSON.stringify(successValue));
                }
                else {
                    // String - can bypass JSON-serialization altogether
                    res.setHeader('Content-Type', 'text/plain');
                    res.end(successValue);
                }
            }
        };
        // Support streamed responses
        Object.defineProperty(callback, 'stream', {
            enumerable: true,
            get: function () {
                if (!hasSentResult) {
                    hasSentResult = true;
                    res.setHeader('Content-Type', 'application/octet-stream');
                }
                return res;
            }
        });
        try {
            var resolvedPath = path.resolve(process.cwd(), bodyJson.moduleName);
            var invokedModule = dynamicRequire(resolvedPath);
            var func = bodyJson.exportedFunctionName ? invokedModule[bodyJson.exportedFunctionName] : invokedModule;
            if (!func) {
                throw new Error('The module "' + resolvedPath + '" has no export named "' + bodyJson.exportedFunctionName + '"');
            }
            func.apply(null, [callback].concat(bodyJson.args));
        }
        catch (synchronousException) {
            callback(synchronousException, null);
        }
    });
});
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
var requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
server.listen(requestedPortOrZero, 'localhost', function () {
    // Signal to HttpNodeHost which port it should make its HTTP connections on
    console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on port ' + server.address().port + '\]');
    // Signal to the NodeServices base class that we're ready to accept invocations
    console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
});
function readRequestBodyAsJson(request, callback) {
    var requestBodyAsString = '';
    request
        .on('data', function (chunk) { requestBodyAsString += chunk; })
        .on('end', function () { callback(JSON.parse(requestBodyAsString)); });
}

// },
/
2 /
/
/ function(module, exports) {

module.exports = require("http");

// },
/
3 /
/
/ function(module, exports) {

module.exports = require("path");

// },
/
4 /
/
/ function(module, exports) {

"use strict";
function parseArgs(args) {
    // Very simplistic parsing which is sufficient for the cases needed. We don't want to bring in any external
    // dependencies (such as an args-parsing library) to this file.
    var result = {};
    var currentKey = null;
    args.forEach(function (arg) {
        if (arg.indexOf('--') === 0) {
            var argName = arg.substring(2);
            result[argName] = undefined;
            currentKey = argName;
        }
        else if (currentKey) {
            result[currentKey] = arg;
            currentKey = null;
        }
    });
    return result;
}
exports.parseArgs = parseArgs;

/_/ }
/
_***/ ])));`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions