customerio / customerio-expo-plugin

MIT License
11 stars 9 forks source link

`PLUGIN NOT FOUND` error running `expo-doctor` > 1.10.1 #151

Closed arndtvoges closed 4 weeks ago

arndtvoges commented 1 month ago

Running npx expo-doctor suddenly fails.

It might have to do with a fix that now properly enforces the requirement for config plugins to export a app.plugin.js?

ami-aman commented 1 month ago

Hi @arndtvoges

Thank you for raising this issue with us.

The error PLUGIN_NOT_FOUND you encountered when running npx expo-doctor usually occurs because expo-doctor expects both app.json and app.config.js files to be present in your project. Could you please confirm if both of these files are included in your project?

arndtvoges commented 1 month ago

Hi @ami-aman,

Thanks for the fast response. I did not have an app.json file in the project root, but adding one also didn't make a difference.

I want to clarify that this used to work just fine the way it was set up just until recently.

I also did a little further testing and it seems that an older version of expo-doctor works. The latest working version for me is npx expo-doctor@1.10.1, seemingly regardless of which of the most recent Expo versions I am using.

Hope that helps.

Edit: I have updated the title to make this issue easier to find should anyone else have this problem.

ami-aman commented 1 month ago

Hey @arndtvoges Thanks for confirming the details and I apologize that the issue still persists.

Next, I suggest trying to update your expo-doctor version to the latest one i.e. 1.11.2. I was able to reproduce the issue with this version and resolved it using the solution I shared in my previous comment.

Please give that a try and let me know if it helps!

eliottishak commented 1 month ago

I am also experiencing @arndtvoges's Issue. We previously used app.config.js, but I added an app.json as you suggested, and I'm afraid this did not help.

package.json

{
     "customerio-expo-plugin": "^1.0.0-beta.15",
    "customerio-node": "^4.1.1",
    "customerio-reactnative": "^3.7.0",
}

app.config.js

plugins: [
        [
          "customerio-expo-plugin",
          {
            ios: {
              pushNotification: {
                useRichPush: true,
                env: {
                  region: "US",
                  siteId: **********,
                  apiKey: ***********,
                },
              },
            },
          },
        ],
]

Console

 yarn dlx expo-doctor
➤ YN0000: · Yarn 4.0.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + expo-doctor@npm:1.11.2
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: · Done in 0s 88ms

/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:89549
  throw new (_errors().PluginError)(`Failed to resolve plugin for module "${pluginReference}" relative to "${projectRoot}"`, 'PLUGIN_NOT_FOUND');
        ^

PluginError: Failed to resolve plugin for module "customerio-expo-plugin" relative to "/workspace/src/ts/apps/expo"
    at resolvePluginForModule (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:89549:9)
    at resolveConfigPluginFunctionWithInfo (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:89598:7)
    at resolveConfigPluginFunction (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:89589:7)
    at withStaticPlugin (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:88669:70)
    at /tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:88510:84
    at Array.reduce (<anonymous>)
    at withPlugins (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:88510:18)
    at withConfigPlugins (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:91158:47)
    at fillAndReturnConfig (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:90080:78)
    at getConfig (/tmp/xfs-79eced50/dlx-33720/node_modules/expo-doctor/build/index.js:90133:12) {
  isPluginError: true,
  code: 'PLUGIN_NOT_FOUND',
  cause: undefined
}
arndtvoges commented 1 month ago

Hey @arndtvoges Thanks for confirming the details and I apologize that the issue still persists.

Next, I suggest trying to update your expo-doctor version to the latest one i.e. 1.11.2. I was able to reproduce the issue with this version and resolved it using the solution I shared in my previous comment.

Please give that a try and let me know if it helps!

Hi @ami-aman, as previously stated, I added an app.json file to my project root, alongside the existing app.config.ts which did not solve the problem. Seems like @eliottishak is experiencing the same.

Since it worked for you, @ami-aman, could you share the minimal app.json file that solved the issue for you?

arndtvoges commented 1 month ago

Hi @ami-aman, just making sure you saw the previous comments since this is still marked as Waiting Customer Response

ami-aman commented 1 month ago

Hey there! Thanks for the follow up !

We've seen your previous comment (and also @eliottishak's comment) and our team tried to reproduce the issue with the latest details you shared, but unfortunately, we were unable to do so. To assist you further, we would appreciate more detailed steps to reproduce the issue, as debugging becomes difficult without reproducing it on our end. If possible, sharing a minimal reproducible app would be very helpful for our team to investigate the issue thoroughly.

Also, I want to confirm if you are using a monorepo (We are using a non-monorepo project to reproduce).

could you share the minimal app.json file that solved the issue for you

Here is the app.json configuration we are using:

"plugins": [
      [
        "customerio-expo-plugin",
        {
          "android": {
            "googleServicesFile": "./files/google.json",
            "setHighPriorityPushHandler": true
          },
          "ios": {
            "pushNotification": {
              "useRichPush": true,
              "env": {
                "siteId": "YourSiteID",
                "apiKey": "YourAPIKey",
                "region": "us"
              }
            }
          }
        }
      ],
]
ybentz commented 1 month ago

@ami-aman we're not using a mono-repo, I'm using the latest expo-doctor and we're also experiencing the same issue. We only have a app.json file and are using many other plugins, 3rd party and custom, with no problem. This is the only plugin that expo-doctor complains about.

The error PLUGIN_NOT_FOUND you encountered when running npx expo-doctor usually occurs because expo-doctor expects both app.json and app.config.js files to be present in your project.

Can you point to where it's mentioned that expo-doctor expects both files to be present? As far as I can tell, app.json should be sufficient, I don't think I've seen that anywhere in the Expo docs so I'd like to read more about it to understand what the issue may be.

hanyufoodles commented 1 month ago

Same here. With expo-doctor@1.11.2 it shows:

/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:89549
  throw new (_errors().PluginError)(`Failed to resolve plugin for module "${pluginReference}" relative to "${projectRoot}"`, 'PLUGIN_NOT_FOUND');
        ^

PluginError: Failed to resolve plugin for module "customerio-expo-plugin" relative to "/Users/hanyu/Workspace/apps/customer-mobile-app"
    at resolvePluginForModule (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:89549:9)
    at resolveConfigPluginFunctionWithInfo (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:89598:7)
    at resolveConfigPluginFunction (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:89589:7)
    at withStaticPlugin (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:88669:70)
    at /Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:88510:84
    at Array.reduce (<anonymous>)
    at withPlugins (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:88510:18)
    at withConfigPlugins (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:91158:47)
    at fillAndReturnConfig (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:90080:78)
    at getConfig (/Users/hanyu/.npm/_npx/89957a0324271eeb/node_modules/expo-doctor/build/index.js:90133:12) {
  isPluginError: true,
  code: 'PLUGIN_NOT_FOUND',
  cause: undefined
}

I have this plugin in app.config.ts:

    [
      'customerio-expo-plugin',
      {
        android: {
          googleServicesFile: process.env.EXPO_PUBLIC_GOOGLE_SERVICES_JSON,
        },
        ios: {
          pushNotification: {
            useRichPush: true,
            env: {
              siteId: process.env.EXPO_PUBLIC_CUSTOMER_IO_SITE_ID,
              apiKey: process.env.EXPO_PUBLIC_CUSTOMER_IO_API_KEY,
              region: process.env.EXPO_PUBLIC_CUSTOMER_IO_REGION,
            },
          },
        },
      },
    ],
ami-aman commented 1 month ago

Hi @ybentz and @hanyufoodles

Apologies for the issue you’re experiencing with our plugin. Unfortunately, despite several efforts, we have been unable to reproduce the issue on our end. The only instance where we could replicate something similar was by removing either app.json or app.config.js, but this doesn’t seem to be a reliable way to consistently reproduce the issue, as it hasn’t resolved the problem for most of our customers.

To assist further, I would appreciate it if you could provide detailed steps to reproduce the issue or share a minimal reproducible app where this issue is occurring. This would help us investigate the problem more effectively.

Thank you for your cooperation, and we look forward to your response

hanyufoodles commented 1 month ago

Hi @ybentz and @hanyufoodles

Apologies for the issue you’re experiencing with our plugin. Unfortunately, despite several efforts, we have been unable to reproduce the issue on our end. The only instance where we could replicate something similar was by removing either app.json or app.config.js, but this doesn’t seem to be a reliable way to consistently reproduce the issue, as it hasn’t resolved the problem for most of our customers.

To assist further, I would appreciate it if you could provide detailed steps to reproduce the issue or share a minimal reproducible app where this issue is occurring. This would help us investigate the problem more effectively.

Thank you for your cooperation, and we look forward to your response

Here you go a minimal reproduction: https://github.com/hanyufoodles/customerio-expo-doctor-reproduction

ami-aman commented 4 weeks ago

@hanyufoodles Thank you for providing the minimal reproducible app. It was incredibly helpful in reproducing the issue on our end. I’m happy to share that we’ve released a fix, and you can upgrade the plugin to version 1.0.0-beta.16 to get the update.

@arndtvoges With the fix now available, I’ll go ahead and close this issue. Please feel free to reopen it if you have any related questions, or open a new one if needed.