MCPcopy Create free account
hub / github.com/CodeGenieApp/serverless-express / proxy

Function proxy

src/configure.js:29–87  ·  view source on GitHub ↗
({
    app = configureApp,
    framework = configureFramework,
    event = {},
    context = {},
    eventSourceName = configureEventSourceName || getEventSourceNameBasedOnEvent({ event }),
    binarySettings = configureBinarySettings || getDefaultBinarySettings(),
    eventSource = configureEventFns || getEventSource({ eventSourceName }),
    eventSourceRoutes = configureEventSourceRoutes || {},
    log = configureLog,
    respondWithErrors = configureRespondWithErrors
  })

Source from the content-addressed store, hash-verified

27 respondWithErrors: configureRespondWithErrors = process.env.NODE_ENV === 'development'
28} = {}) {
29 function proxy ({
30 app = configureApp,
31 framework = configureFramework,
32 event = {},
33 context = {},
34 eventSourceName = configureEventSourceName || getEventSourceNameBasedOnEvent({ event }),
35 binarySettings = configureBinarySettings || getDefaultBinarySettings(),
36 eventSource = configureEventFns || getEventSource({ eventSourceName }),
37 eventSourceRoutes = configureEventSourceRoutes || {},
38 log = configureLog,
39 respondWithErrors = configureRespondWithErrors
40 }) {
41 log.debug('SERVERLESS_EXPRESS:PROXY', () => ({
42 event: util.inspect(event, { depth: null }),
43 context: util.inspect(context, { depth: null }),
44 eventSourceName,
45 binarySettings,
46 respondWithErrors
47 }))
48
49 setCurrentInvoke({ event, context })
50 return new Promise((resolve, reject) => {
51 const promise = {
52 resolve,
53 reject
54 }
55 const resolver = makeResolver({
56 promise
57 })
58 const handleError = (error) => {
59 respondToEventSourceWithError({
60 error,
61 resolver,
62 log,
63 respondWithErrors,
64 eventSourceName,
65 eventSource,
66 event
67 })
68 }
69
70 try {
71 forwardRequestToNodeServer({
72 app,
73 framework,
74 event,
75 context,
76 resolver,
77 eventSourceName,
78 binarySettings,
79 eventSource,
80 eventSourceRoutes,
81 log
82 }).catch(handleError)
83 } catch (error) {
84 handleError(error)
85 }
86 })

Callers 1

handlerFunction · 0.85

Calls 7

getDefaultBinarySettingsFunction · 0.85
getEventSourceFunction · 0.85
setCurrentInvokeFunction · 0.85
makeResolverFunction · 0.85
handleErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…