stripe-firebase-extensions: firestore-stripe-payments v0.0.4 has error: SyntaxError: Unexpected token 'export'
Bug report
Describe the bug
in Next.js
import {
createCheckoutSession,
getStripePayments,
} from '@stripe/firestore-stripe-payments';
// some code ...
👇🏻
SyntaxError: Unexpected token 'export'
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
<unknown>
/Users/nino/Projects/simple-flock/node_modules/ (stripe/firestore-stripe-payments/lib/index.js (16)
Object.compileFunction
node:vm (352:18)
wrapSafe
node:internal/modules/cjs/loader (1025:15)
Module._compile
node:internal/modules/cjs/loader (1059:27)
Object.Module._extensions..js
node:internal/modules/cjs/loader (1147:10)
Module.load
node:internal/modules/cjs/loader (975:32)
Function.Module._load
node:internal/modules/cjs/loader (822:12)
Module.require
node:internal/modules/cjs/loader (999:19)
require
node:internal/modules/cjs/helpers (102:18)
Object.@stripe/firestore-stripe-payments
file:///Users/nino/Projects/simple-flock/.next/server/pages/mypage.js (197:18)
__webpack_require__
file:///Users/nino/Projects/simple-flock/.next/server/webpack-runtime.js (33:42)
v0.0.3 is work ✅ v0.0.4 has error 🚫
Thank you for your support 😃
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 10
- Comments: 18 (2 by maintainers)
For those experiencing this bug, you can add this to your
next.config.js
:Edit: You will need to restart the server and might still get an error in the console, but the package should still work normally.
I was able to reproduce this issue on all versions
v0.0.3
tov0.0.6
with anext-js
starter project.Couldn’t find any specific config changes that could cause this in
firestore-stripe-payments
codebase. However, I was able to fix the error by adding the following tonext.config.js
.Let us know if using
next-transpile-modules
innext.config.js
could be a workaround until we find the root cause for this issue. Thanks!FYI: @lemuel-stripe @cjavilla-stripe
With the sdk update, you need to change the workaround to :
Same issue here, starting a new project that only has
npm i firebase
andnpm i @stripe/firestore-stripe-payments
withimport getStripePayments from '@stripe/firestore-stripe-payments'
and running the file withnode <filename>.js
is enough to reproduce the issue.