-
Notifications
You must be signed in to change notification settings - Fork 0
fix: fn is not a function #1
base: master
Are you sure you want to change the base?
Conversation
This commit fix the previous error: ``` server listening on 8080 /usr/libexec/s2i/ocf-nodejs-adapter/handler.js:6 fn(ctx); ^ TypeError: fn is not a function at Server.<anonymous> (/usr/libexec/s2i/ocf-nodejs-adapter/handler.js:6:5) at Server.emit (events.js:182:13) at parserOnIncoming (_http_server.js:652:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17) ``` And now we able to see the future/next error: ``` server listening on 8080 loading: [object Object] internal/modules/cjs/loader.js:583 throw err; ^ Error: Cannot find module '/opt/app-root/src/[object Object]' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:20:18) at module.exports (/opt/app-root/src/load.js:3:10) at adapt (/opt/app-root/src/index.js:5:14) at Server.<anonymous> (/usr/libexec/s2i/ocf-nodejs-adapter/handler.js:6:5) at Server.emit (events.js:182:13) at parserOnIncoming (_http_server.js:652:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17) ```
where does this My original code is pretty crap-tastic, I do realize. :) The idea was to wrap the raw function with another function that handles the httpHandler bits, and then wrap that all entirely with the httpServer. So would prefer being able to wrap any random function, instead of requiring anyone to write an |
I just added
Nah, basically linting issues other than that is good 👍
I think I got your idea.
Makes sense, It was a quick shot , I was curious to see it working. : ] |
So ultimately this needs to be run from within a different project The entry-point is https://github.com/openshift-cloud-functions/ocf-nodejs-adapter/blob/master/bin/run.js but then it takes the path to your function (in a different project which should be your $PWD) or figures it out from the Then In theory. The s2i works by changing into the $PWD of the fn project (such as https://github.com/openshift-cloud-functions/ocf-nodejs-example), then running the above (see the README in the example project: https://github.com/openshift-cloud-functions/ocf-nodejs-example/blob/master/README) |
Thanks for the extra clarification. yah this is the full path I think this needs |
Okie dokie. That's just plain weird.
fwiw, I'm on node-10ish. You?
…On Thu, Oct 11, 2018 at 12:00 PM Helio Frota ***@***.***> wrote:
Thanks for the extra clarification.
yah this is the full path '/opt/app-root/src/[object Object]' from the
error message on the commit comment.
I think this needs JSON.stringify to be -> index.js
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAA-T2wmP4gefU3egb_eSEhSKihypHXVks5uj2s2gaJpZM4XXxZW>
.
|
Yup me too
|
This commit fix the previous error:
And now we able to see the future/next error: