Skip to content

When using any optimizely function on ssr uuid dependency breaks #1078

@lorenzo-lungo

Description

@lorenzo-lungo

Is there an existing issue for this?

  • I have searched the existing issues

SDK Version

6.0.0

Current Behavior

When importing uuid on server side (no matter where) this is the log I get

Cannot read properties of undefined (reading 'v1')

Cannot read properties of undefined (reading 'v1') at /Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]/node_modules/uuid/wrapper.mjs:16:42) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async ViteNodeRunner.runModule (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:397:4) at async ViteNodeRunner.directRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:375:3) at async ViteNodeRunner.cachedRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:189:11) at async ViteNodeRunner.dependencyRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:239:10) at async /Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/@[email protected][email protected]/node_modules/@optimizely/optimizely-sdk/dist/index.node.es.min.mjs:22:31) at async ViteNodeRunner.runModule (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:397:4) at async ViteNodeRunner.directRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:375:3) at async ViteNodeRunner.cachedRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:189:11)

Expected Behavior

It should correctly import the dependency

I was able to avoid the issue by downgrading uuid dependency to version 7.0.3 by doing

"overrides": {
      "@optimizely/optimizely-sdk>uuid": "7.0.3"
    },

Steps To Reproduce

In a nuxt (or next environment), or in a node server side environment
Import the @optimizely/optimizely-sdk anywhere and be sure that that part of the code runs server side
Notice that the issue reported above happens

SDK Type

Node

Node Version

22.15.0

Browsers impacted

The issue is server side

Link

No response

Logs

Cannot read properties of undefined (reading 'v1')

Cannot read properties of undefined (reading 'v1') at /Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/[email protected]/node_modules/uuid/wrapper.mjs:16:42) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async ViteNodeRunner.runModule (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/vite-node@3.2.4_@types[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:397:4) at async ViteNodeRunner.directRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/vite-node@3.2.4_@types[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:375:3) at async ViteNodeRunner.cachedRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/vite-node@3.2.4_@types[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:189:11) at async ViteNodeRunner.dependencyRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/vite-node@3.2.4_@types[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:239:10) at async /Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/@optimizely[email protected][email protected]/node_modules/@optimizely/optimizely-sdk/dist/index.node.es.min.mjs:22:31) at async ViteNodeRunner.runModule (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/vite-node@3.2.4_@types[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:397:4) at async ViteNodeRunner.directRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/vite-node@3.2.4_@types[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:375:3) at async ViteNodeRunner.cachedRequest (/Users/lorenzolungo/Work/canvas-storefront/node_modules/.pnpm/vite-node@3.2.4_@types[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/client.mjs:189:11)

Severity

Blocking development

Workaround/Solution

No response

Recent Change

Yes, after the 6.0.0 update

Conflicts

No response

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