Contentful import error in Hydrogen

Contentful import error in Hydrogen

m_ahtisham
Visitor
1 0 0
We are using Shopify hydrogen and remix to build a headless e-commerce site. We are trying to integrate contentful to fetch data from contentful. We are facing issues in integrating contentful with Shopify hydrogen and remix. We are looking for someone who has experience in integrating contentful with Shopify hydrogen and remix.
These are the dependencies:
{   "@remix-run/react": "^2.10.1",
    "@remix-run/server-runtime": "^2.10.1",
    "@shopify/hydrogen": "2024.7.2",
    "@shopify/remix-oxygen": "^2.0.5",
    "contentful": "^10.12.15",
}

when we try to import contentful in the server.ts file, we are getting the following error:

On browser Window:
(
    EvalError: Code generation from strings disallowed for this context
    at Function ()
    at Object.3960 (V😕React/rebuilt-dev/node_modules/contentful/dist/contentful.browser.min.js:1:44694)
    at r (V😕React/rebuilt-dev/node_modules/contentful/dist/contentful.browser.min.js:1:135729)
    at V:/React/rebuilt-dev/node_modules/contentful/dist/contentful.browser.min.js:1:143013
    at V:/React/rebuilt-dev/node_modules/contentful/dist/contentful.browser.min.js:1:213991
    at V:/React/rebuilt-dev/node_modules/contentful/dist/contentful.browser.min.js:1:213991
    at V:/React/rebuilt-dev/node_modules/contentful/dist/contentful.browser.min.js:1:276
    at V:/React/rebuilt-dev/node_modules/contentful/dist/contentful.browser.min.js:1:278
)

On server console:

MiniOxygen encountered an error while running your app's entry point:                                                 │
│                                                                                                                        │
│  EvalError: Code generation from strings disallowed for this context                                                   │
│  EvalError: Code generation from strings disallowed for this context                                                   │
│                                                                                                                        │
│  To investigate the issue, examine this stack trace:                                                                   │
│    at Function                                                                                                         │
│    at 3960 (contentful/dist/contentful.browser.min.js:1)                                                               │
│    at r (contentful/dist/contentful.browser.min.js:1)                                                                  │
│    at (contentful/dist/contentful.browser.min.js:1)                                                                    │
│    at (contentful/dist/contentful.browser.min.js:1)                                                                    │
│    at (contentful/dist/contentful.browser.min.js:1)                                                                    │
│    at (contentful/dist/contentful.browser.min.js:1)                                                                    │
│    at (contentful/dist/contentful.browser.min.js:1)  


Can you help us to resolve this issue?
Screenshot of the error also attached.
Screenshot (766).png
Replies 0 (0)