Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ShelbyZ opened this issue Oct 5, 2020 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@ShelbyZ
Copy link
Contributor

ShelbyZ commented Oct 5, 2020

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.

@philnash philnash added this to the Post v3 milestone Feb 25, 2021
@makserik makserik added the bug Something isn't working label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants