Skip to content

Uncaught promise TypeError: Cannot read properties of undefined (analyticsOptions) #181

@ctwheels

Description

@ctwheels

For which package is this issue?

Current version (1.5.0) and previous versions from 1.0.0 (December 21, 2021)

Describe the issue in a sentence or two.

Uncaught exception when not passing analyticsOptions to HtmlImageLayer class constructor. The analyticsOptions is optional parameter for the class, but then when the values are assigned, doesn't have a fallback or check if analyticsOptions is undefined, so raises exception. Documentation also doesn't explain this option anywhere so impossible to configure.

Suggestion is to change logic to optionally add analytics options if parameter is set and ignore otherwise. Error raised on this line: https://github.com/cloudinary/frontend-frameworks/blob/master/packages/html/src/layers/htmlImageLayer.ts#L19 but also present on line 39 of the same file

Issue Type (Can be multiple)

[x ] Performance - Performance issues
[x ] Behaviour - Functions aren’t working as expected
[x ] Documentation - Inconsistency between the docs and behaviour
[x ] Other (Specify): Bug

Steps to reproduce

new HtmlImageLayer(
	imgElement, // img element
	image, // CloudinaryImage
	plugins, // optional plugins
);

Error screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions