Skip to content

Cannot use Jitsu in a NextJs MIddleware #1103

Closed
@thibaultleouay

Description

@thibaultleouay

We are using Jitsu to track analytics

But because of this it cannot be used in middleware

Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime 
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

The error was caused by importing '@jitsu/js/dist/jitsu.es.js' in   in '../../packages/analytics/src/index.ts' 

https://github.com/jitsucom/jitsu/blob/70fdf6a5000640ba46732331f65bea46e165e153/libs/jitsu-js/src/destination-plugins/tag.ts#L59C1-L73C14

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