chrisdmacrae / atomic-algolia

An NPM package for running atomic updates to an Algolia indices
67 stars 13 forks source link

[BUG] CloudFlare Pages: EvalError: Code generation from strings disallowed for this context #40

Open regisphilibert opened 2 years ago

regisphilibert commented 2 years ago

Description

The package fails on CloudFlare Workers / Cloudflare Pages Functions

Steps to reproduce

Scenario: I'm trying to use atomic-algolia in a CloudFlare Pages Functions
When using atomic-algolia with CF Pages Functions Wrangler throws this error: EvalError: Code generation from strings disallowed for this context
[pages:err] EvalError: Code generation from strings disallowed for this context
    at Function (<anonymous>)
    at node_modules/regenerator-runtime/runtime.js (/Users/regisphilibert/Boulot/tnd/retroreport.org/node_modules/regenerator-runtime/runtime.js:747:3)
    at __require2 (/var/folders/t7/9pbqz9_17llf0v0x7k3nxnkm0000gn/T/functionsWorker-0.9821669927980017.js:16:50)
    at node_modules/@babel/runtime/regenerator/index.js (/Users/regisphilibert/Boulot/tnd/retroreport.org/node_modules/@babel/runtime/regenerator/index.js:1:18)
    at __require2 (/var/folders/t7/9pbqz9_17llf0v0x7k3nxnkm0000gn/T/functionsWorker-0.9821669927980017.js:16:50)
    at node_modules/atomic-algolia/lib/utils/getRemoteIndex.js (/Users/regisphilibert/Boulot/tnd/retroreport.org/node_modules/atomic-algolia/lib/utils/getRemoteIndex.js:5:43)
    at __require2 (/var/folders/t7/9pbqz9_17llf0v0x7k3nxnkm0000gn/T/functionsWorker-0.9821669927980017.js:16:50)
    at node_modules/atomic-algolia/lib/update.js (/Users/regisphilibert/Boulot/tnd/retroreport.org/node_modules/atomic-algolia/lib/update.js:17:22)
    at __require2 (/var/folders/t7/9pbqz9_17llf0v0x7k3nxnkm0000gn/T/functionsWorker-0.9821669927980017.js:16:50)
    at node_modules/atomic-algolia/lib/index.js (/Users/regisphilibert/Boulot/tnd/retroreport.org/node_modules/atomic-algolia/lib/index.js:6:14)

This thread is not about this package, but makes me think there is no workaround.

System information

atomic-algolia version: 0.3.19 node version: v16.14.2 npm version: 8.5.0 system OS: 12.4 (21F79)

More

Note that CloudFlare Pages Functions do not have a log available yet. So I'm not able to see if the error is present outside on local development using Wrangler.

CloudFlare security has this restriction, it seems Vercel as well but not sure.