Skip to content

CORS failure results in Uncaught TypeError: Cannot read properties of undefined (reading 'forEach') in recorder.ts #1459

Open
@hugonasciutti

Description

@hugonasciutti

Hello,

I encountered the following error with posthog-js version 1.166.2:

recorder.ts:688 Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')

This error occurs when my request fails due to a CORS policy restriction. I’ve attached a screenshot for reference.

image
image

It seems to be here:

const responseHeaders: Headers = {}
res.headers.forEach((value, header) => {
responseHeaders[header] = value
})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions