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

Error in SnowWizard while running GET /api/incidents: TypeError: Cannot read properties of undefined (reading 'length') #15

Open
acamina opened this issue Nov 2, 2024 · 1 comment

Comments

@acamina
Copy link

acamina commented Nov 2, 2024

get this errors while running the example :

[2024-11-02T17:10:08.915Z] Executing 'Functions.incidents' (Reason='This function was programmatically called via the host APIs.', Id=7e0fa89a-ed9f-47ee-b747-56b6a8f839d5)
[2024-11-02T17:10:09.093Z] Ô×í´©Å POST /api/incidents:
[2024-11-02T17:10:09.961Z] User fetched successfully from ServiceNow: undefined
[2024-11-02T17:10:09.969Z] Error creating incident: TypeError: Cannot read properties of undefined (reading '0')
[2024-11-02T17:10:09.977Z] at IncidentsApiService. (C:\Temp-open\da-SnowWizard\SnowWizard\dist\src\services\snow_incidents.js:184:40)
[2024-11-02T17:10:09.982Z] at Generator.next ()
[2024-11-02T17:10:09.988Z] at fulfilled (C:\Temp-open\da-SnowWizard\SnowWizard\dist\src\services\snow_incidents.js:30:58)
[2024-11-02T17:10:09.992Z] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-11-02T17:10:09.999Z] ÔØî GET /api/incidents: TypeError: Cannot read properties of undefined (reading '0')
[2024-11-02T17:10:10.122Z] Executed 'Functions.incidents' (Succeeded, Id=7e0fa89a-ed9f-47ee-b747-56b6a8f839d5, Duration=1285ms)
[2024-11-02T17:10:34.625Z] Executing 'Functions.incidents' (Reason='This function was programmatically called via the host APIs.', Id=c7bceda8-ce12-4a82-bb2a-3eb39d0f8772)

@cristianoag
Copy link
Contributor

Since authentication was not implemented yet, the application uses a specific user account to create incidents. You can modify this user’s email in the incidents.ts file. However, the recommended approach is to authenticate the user on the Copilot side, utilizing the current user's credentials to create incidents. This example is for demonstration purposes only.

In the log file you provided (see below), the user [email protected]—which is valid in the sample ServiceNow tenant available through the development program—is showing as undefined in your environment.

[2024-11-02T17:10:09.961Z] User fetched successfully from ServiceNow: undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants