Skip to content

'private' Twilio Functions are accessible via endpoint and docs seems to point otherwise #194

@ShelbyZ

Description

@ShelbyZ

File/code in question:

if (routeInfo && routeInfo.type === 'function') {
const functionPath = routeInfo.filePath;
try {
if (!functionPath) {
throw new Error('Missing function path');
}
debug('Load & route to function at "%s"', functionPath);
const twilioFunction = loadTwilioFunction(functionPath);
if (typeof twilioFunction !== 'function') {
return res
.status(404)
.send(
`Could not find a "handler" function in file ${functionPath}`
);
}
if (config.forkProcess) {
functionPathToRoute(functionPath, config)(req, res, next);
} else {
functionToRoute(twilioFunction, config, functionPath)(
req,
res,
next
);
}
} catch (err) {
debug('Failed to retrieve function. %O', err);
if (err.code === 'ENOENT') {
res.status(404).send(`Could not find function ${functionPath}`);
} else {
res.status(500).send(wrapErrorInHtml(err, functionPath));
}
}

Docs:
https://www.twilio.com/docs/runtime/functions-assets-api/api/understanding-visibility-public-private-and-protected-functions-and-assets#private

Functions structure:
image

Output:
image

This is something that needs clarification from the Functions team as to what behavior should be expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions