Skip to content

Cannot read properties of undefined (reading 'type') #210

Closed
@GravlLift

Description

@GravlLift

Investigative information

Please provide the following:

  • Timestamp: 2024-01-22T22:14:28.4980344Z
  • Function App name: AZUD-RMS-FA-01
  • Function name(s) (as appropriate): customerLookup
  • Invocation ID: 3325acd5-1aad-4923-bffc-0a6fbfe52204
  • Region: East US 2

Repro steps

Provide the steps required to reproduce the problem:

  1. Open https://azud-rms-fa-01.azurewebsites.net/api/v4/customer?emailAddress=lightspeed.e2e%40gmail.com in a browser

Expected behavior

Provide a description of the expected behavior.

Http request should return valid JSON and 200 response

Actual behavior

500 error

Related information

Provide any related information

  • Programming language used: javascript
  • Bindings used:
app.get("customerLookup", {
  authLevel: "anonymous",
  route: `api/v{version:int:min(4):max(${currentMajorVersion})}/customer`,
  handler,
});
  • Stack Trace:
Stack: TypeError: Cannot read properties of undefined (reading 'type')
    at InvocationModel.<anonymous> (/node_modules/@azure/functions/dist/webpack:/@azure/functions/src/InvocationModel.ts:65:63)
    at Generator.next (<anonymous>)
    at <anonymous> (/node_modules/@azure/functions/dist/webpack:/@azure/functions/src/InvocationContext.ts:96:10)
    at new Promise (<anonymous>)
    at __webpack_modules__../src/InvocationModel.ts.__awaiter (/node_modules/@azure/functions/dist/webpack:/@azure/functions/src/InvocationContext.ts:96:10)
    at InvocationModel.getArguments (/node_modules/@azure/functions/dist/webpack:/@azure/functions/src/InvocationModel.ts:46:23)
    at y.<anonymous> (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:37611)
    at Generator.next (<anonymous>)
    at o (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:35629)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 

This error is not reproducible locally, only on our Azure instance. While it is reproducible for a single function run, restarting the function will fix the issue.

Relevant code appears to be here:

async getArguments(): Promise<InvocationArguments> {
const req = this.#coreCtx.request;
const context = new InvocationContext({
invocationId: nonNullProp(this.#coreCtx, 'invocationId'),
functionName: this.#functionName,
logHandler: (level: RpcLogLevel, ...args: unknown[]) => this.#userLog(level, ...args),
retryContext: fromRpcRetryContext(req.retryContext),
traceContext: fromRpcTraceContext(req.traceContext),
triggerMetadata: fromRpcTriggerMetadata(req.triggerMetadata, this.#triggerType),
options: fromRpcBindings(this.#bindings),
});
const inputs: unknown[] = [];
if (req.inputData) {
for (const binding of req.inputData) {
const bindingName = nonNullProp(binding, 'name');
let input: unknown = fromRpcTypedData(binding.data);
const bindingType = this.#bindings[bindingName].type;
if (isTimerTrigger(bindingType)) {
input = toCamelCaseValue(input);
}
if (isTrigger(bindingType)) {
inputs.push(input);
} else {
context.extraInputs.set(bindingName, input);
}
}
}
return { context, inputs };
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions