question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom App documentation example - formMiddleware

See original GitHub issue

What you were expecting:

By following tutorial at https://marmelab.com/react-admin/CustomApp.html I should be able to configure custom provider.

What happened instead:

Got an exception:

redux.js:567 Uncaught TypeError: middleware is not a function
    at redux.js:567
    at Array.map (<anonymous>)
    at redux.js:566
    at <anonymous>:1:28482
    at Module.createStore (redux.js:87)
    at Object.configureStore [as default] (configure-store.ts:49)
    at Object../src/redux.ts (redux.ts:9)
    at __webpack_require__ (bootstrap:721)
    at fn (bootstrap:98)
    at Object../src/index.tsx (index.tsx:7)
    at __webpack_require__ (bootstrap:721)
    at fn (bootstrap:98)
    at Object.0 (serializer.ts:4)
    at __webpack_require__ (bootstrap:721)
    at ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.module.exports (bootstrap:788)
    at bootstrap:788

Steps to reproduce:

Following the docs for CustomApp.

Related code:

https://github.com/marmelab/react-admin/pull/2249/files#diff-48a1c77367d4a9f0308adfcc0157fc29L17 It seems the middleware was removed and no longer needed.

Environment

  • React-admin version: 2.3.0
  • React version: 16.3.0

Also, it seems the import of formReducer is missing. I guessed it should have been:

import { reducer as formReducer } from 'redux-form'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
dsinai14commented, Nov 16, 2018

Seems that this issue still not resolved in 2.4.2, When importing

import { formMiddleware } from 'react-admin';

I am getting:

TypeError: middleware is not a function

When importing it directly from node_modules/ra-core/esm/form/formMiddleware, I am unable to build using CRA scripts with the following error:

Failed to minify the code from this file:

./node_modules/ra-core/src/form/formMiddleware.js:18

5reactions
DavidEstebanSaizcommented, Oct 17, 2018

Hello, I’m trying to create my own store to access from DataProvider but I think I have a similar problem. When I try to implement createAdminStore.js as indicated in the documentation, the following error appears when importing formMiddleware

error: ‘react-admin’ does not contain an export named ‘formMiddleware’.

Versiones React-admin: “2.3.4” React: “16.5.2”

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Create a Custom Middleware in Express.js
Learn how to write and use your own custom Express.js middleware by using res, req, and next.
Read more >
Writing middleware for use in Express apps
Here is a simple example of a middleware function called “myLogger”. This function just prints “LOGGED” when a request to the app passes...
Read more >
Write custom ASP.NET Core middleware - Microsoft Learn
Learn how to write custom ASP.NET Core middleware.
Read more >
Build and Understand Express Middleware through Examples
This tutorial walks you through creating and understanding middleware for Express.
Read more >
Building a Document Browser App for Custom File Formats
Implement a custom document file format to manage user interactions with files on different cloud storage providers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found