Skip to content

Sieve example isn't working out of the box #7

Closed
@PaulsBecks

Description

@PaulsBecks

Hey there, first of all great work.

Right now the example does not work for me out of the box. I would like to suggest a solution and make a PR.

When I run ./scripts/upload.sh ../examples/sieve-of-erasthostenes sieve 2 the docker images are build, but they fail on start-up, with the following error:

/usr/src/app/node_modules/express/lib/router/route.js:202
        throw new Error(msg);
        ^

Error: Route.acl() requires a callback function but got a [object Undefined]
    at Route.(anonymous function) [as acl] (/usr/src/app/node_modules/express/lib/router/route.js:202:15)
    at Function.all (/usr/src/app/node_modules/express/lib/application.js:504:23)
    at Object.<anonymous> (/usr/src/app/functionhandler.js:10:5)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)

This error is thrown when trying to use the function as a route in the functionhandler.js

const handler = require('fn')

app.all('/*', handler.tinyfaasHandler);

To solve this issue I would suggest to export the example the following way (1):

module.exports.tinyfaasHandler = (req, res) => {

Or to change functionhandler.js to add the handler in the following way (2):

app.all('/*', handler);

Metadata

Metadata

Assignees

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