stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

INVALID_PLUGIN_IMPORT on EAS build

Open gpawlik opened this issue 6 months ago • 10 comments

Describe the bug I get this error when creating a build via Expo EAS. I am on the newest version of Expo (53.0.7) and @stripe/stripe-react-native (0.45.0). I have installed the library as indicated in the docs https://github.com/stripe/stripe-react-native?tab=readme-ov-file#expo

 PluginError: Package "@stripe/stripe-react-native" does not contain a valid
    config plugin.
    Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin

    Cannot use import statement outside a module
    Code: INVALID_PLUGIN_IMPORT

gpawlik avatar May 05 '25 16:05 gpawlik

I'm having this same issue. We upgraded React Native/Expo to the newest versions and now Stripe is broken.

Dev Build Error

Package "@stripe/stripe-react-native" does not contain a valid config plugin.
Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin

Unexpected token 'typeof'
    Error: build command failed.

Here's our set up:

Dependencies in package.json:

    "expo": "53.0.7",
    "react": "19.0.0",
    "react-native": "0.79.2",
    "@stripe/stripe-react-native": "^0.45.0",

App Config:

      [
        '@stripe/stripe-react-native',
        {
          urlScheme: '<my-app>://',
          merchantIdentifier: 'merchant.com.<my-app>',
          enableGooglePay: false,
        },
      ],

App.js Stripe Wrapper

<StripeProvider
      publishableKey={<PK>}
      merchantIdentifier="merchant.com.<my-app>"
      urlScheme="<my-app>://"
>

/* ... code... */

</StripeProvider>

victoriamcn avatar May 05 '25 17:05 victoriamcn

Hello, I could use some more information to debug further:

  • This happens when building for which platform?
  • What version of node are you using?
  • Does this happens only on EAS or can you reproduce the issue locally too?

janicduplessis avatar May 05 '25 20:05 janicduplessis

same issue

Image

tm00-git avatar May 21 '25 10:05 tm00-git

Bump!

JackBDart avatar May 30 '25 22:05 JackBDart

Bump as well :-)

johanndms avatar Jun 03 '25 17:06 johanndms

Getting same

raahimkhan avatar Jun 10 '25 06:06 raahimkhan

Having the same issue

AninaLipocheck avatar Jun 10 '25 12:06 AninaLipocheck

I also encountered this same issue when creating an iOS build. I think the problem seems to be a syntax issue within the config plugin, likely due to untranspiled typescript.

As a temporary hotfix, I created a local, pure JavaScript copy of the plugin (/plugins/withFixedStripe.js) and updated my app.json to reference it directly

{
  "expo": {
    "plugins": [
      ["./plugins/withFixedStripe.js", {
        "merchantIdentifier": "merchant.com.example",
        "enableGooglePay": true
      }]
    ]
  }
}

This workaround allows the app to build successfully, and both Apple Pay and Google Pay works correctly. It's not a permanent solution, but it works until it's fixed.

kevinmuoz avatar Jun 10 '25 21:06 kevinmuoz

Have the same issue locally. Reinstalling packages and running rebuild does not fix it.

This seems to work for Expo:

// app.json
{
  "expo": {
      ...
      [
        "@stripe/stripe-react-native/app.plugin.js", 
        {
          "merchantIdentifier": "merchant.com.example",
          "enableGooglePay": true
        }
      ],
  }
}

jinsley8 avatar Jun 19 '25 03:06 jinsley8