Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task-manager][BackgroundFetch]PluginError: Plugin is an unexpected type: object #29086

Closed
aymanMFD opened this issue May 24, 2024 · 1 comment
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@aymanMFD
Copy link

Minimal reproducible example

https://github.com/aymanMFD/Monitoring-System.git

What platform(s) does this occur on?

No response

Did you reproduce this issue in a development build?

Yes

Summary

When trying task-manager and backgroundFetch, the console gives me this error PluginError: Plugin is an unexpected type: object.

Outside of react component

TaskManager.defineTask(BACKGROUND_FETCH_TASK, async () => {
  const now = Date.now();
  sendNotif("Background?");
  console.log(`Got background fetch call at date: ${new Date(now).toISOString()}`);

  // Be sure to return the successful result type!
  return BackgroundFetch.BackgroundFetchResult.NewData;
});

async function registerBackgroundFetchAsync() {
    return BackgroundFetch.registerTaskAsync(BACKGROUND_FETCH_TASK, {
      minimumInterval: 60 * 1, // 15 minutes
      stopOnTerminate: false, // android only,
      startOnBoot: true, // android only
    });
  }

In my react component

    useEffect(() => {
        registerBackgroundFetchAsync();
        TaskManager.isTaskRegisteredAsync().then(res => {console.log(`Task registered: ${res}`)});
    }, [])

Environment

expo-env-info 1.2.0 environment info:
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
npmPackages:
expo: ~51.0.8 => 51.0.8
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
react-native-web: ~0.19.6 => 0.19.10
Expo Workflow: managed

Expo Doctor Diagnostics

There was a lot to text but couldn't paste it due to work limit

PluginError: Plugin is an unexpected type: object
at withStaticPlugin (C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:53:425334)
at C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:53:422676
at Array.reduce ()
at withPlugins (C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:53:422621)
at withConfigPlugins (C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:53:481353)
at fillAndReturnConfig (C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:53:465809)
at getConfig (C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:53:466626)
at actionAsync (C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:59:100143)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async run (C:\Users\mumfdu358\AppData\Local\npm-cache_npx\89957a0324271eeb\node_modules\expo-doctor\build\index.js:59:101815) {
isPluginError: true,
code: 'INVALID_PLUGIN_TYPE',
cause: undefined
}

Node.js v20.11.1

@aymanMFD aymanMFD added the needs validation Issue needs to be validated label May 24, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 24, 2024
@aymanMFD
Copy link
Author

Nvm it was a mistake I did in app.json file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants