Is it possible to use spanner nodejs client library in workers?

Anyone know if it's possible to use the nodejs spanner client library in a cloudflare worker with node compatibility flags? I tried but failed so just wanted to check if it's a skill issue. I get this error:
⎔ Starting local server...
✘ [ERROR] service core:user:spanner-hono-cloudflare: Uncaught TypeError: __require.resolve is not a function

at null.<anonymous> (index.js:49631:57) in
node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/spanner/build/src/common-grpc/service.js
at null.<anonymous> (index.js:32:51) in __require2
at null.<anonymous> (index.js:155552:21) in
node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/spanner/build/src/index.js
at null.<anonymous> (index.js:32:51) in __require2
at null.<anonymous> (index.js:158271:30)



✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above.
⎔ Starting local server...
✘ [ERROR] service core:user:spanner-hono-cloudflare: Uncaught TypeError: __require.resolve is not a function

at null.<anonymous> (index.js:49631:57) in
node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/spanner/build/src/common-grpc/service.js
at null.<anonymous> (index.js:32:51) in __require2
at null.<anonymous> (index.js:155552:21) in
node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/spanner/build/src/index.js
at null.<anonymous> (index.js:32:51) in __require2
at null.<anonymous> (index.js:158271:30)



✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above.
https://github.com/googleapis/nodejs-spanner Edit: I've been manually refactoring the library but now running into this error: "[unenv] child_process.exec is not implemented yet!" it looks like wrangler 3.106.0 is using v2 of unenv which states child_process is compatibile but appears not
GitHub
GitHub - googleapis/nodejs-spanner: Node.js client for Google Cloud...
Node.js client for Google Cloud Spanner: the world’s first fully managed relational database service to offer both strong consistency and horizontal scalability. - googleapis/nodejs-spanner
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?