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

TypeError: e?.map is not a function #1392

Open
tangfei opened this issue Oct 12, 2024 · 2 comments
Open

TypeError: e?.map is not a function #1392

tangfei opened this issue Oct 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@tangfei
Copy link

tangfei commented Oct 12, 2024

System Info

pandasai:2.2.15
python:3.12.4
masos

πŸ› Describe the bug

> [email protected] build
> next build

  β–² Next.js 14.2.15
  - Environments: .env

   Creating an optimized production build ...
 βœ“ Compiled successfully
   Skipping linting
 βœ“ Checking validity of types
 βœ“ Collecting page data
   Generating static pages (7/15)  [=   ]TypeError: e?.map is not a function
    at c (/Users/tom_tang/Projects/pandas-ai/client/build/server/app/settings/workspaces/page.js:1:10168)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  digest: '3282278517'
}
TypeError: e?.map is not a function
    at c (/Users/tom_tang/Projects/pandas-ai/client/build/server/app/settings/workspaces/page.js:1:10168)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  digest: '3282278517'
}

Error occurred prerendering page "/settings/workspaces". Read more: https://nextjs.org/docs/messages/prerender-error

TypeError: e?.map is not a function
    at c (/Users/tom_tang/Projects/pandas-ai/client/build/server/app/settings/workspaces/page.js:1:10168)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
 βœ“ Generating static pages (15/15)

> Export encountered errors on following paths:
	/settings/workspaces/page: /settings/workspaces
Copy link

dosubot bot commented Oct 12, 2024

Hey @tangfei! I'm here to help you with any bugs, questions, or contributions you have for pandasai. Let's squash that bug together!

The error "TypeError: e?.map is not a function" suggests that e is not an array or iterable object when the map function is called. Here are a few steps to troubleshoot and resolve this issue:

  1. Check Initialization: Ensure that e is initialized as an array or iterable before the map function is called. If e can be null or undefined, consider providing a default value, like an empty array.

  2. Type Checking: Add a type check before calling map to ensure e is an array:

    if (Array.isArray(e)) {
        e.map(item => {
            // Your logic here
        });
    }
  3. Debugging: Add console logs to check the value and type of e before the map call to understand what data is being passed:

    console.log('e:', e);
    console.log('Type of e:', typeof e);
  4. Data Source: Verify the data source or API that populates e to ensure it returns an array.

These steps should help identify and fix the issue with the map function call.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the bug Something isn't working label Oct 12, 2024
@tangfei
Copy link
Author

tangfei commented Oct 12, 2024

I change client Dockerfile

FROM node:19.4.0-alpine3.17

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

EXPOSE 3000

CMD ["npm", "start"]

now the result is:

ERROR [client 6/6] RUN npm run build                                                                                                                                                                      40.2s
------
 > [client 6/6] RUN npm run build:
0.553
0.553 > [email protected] build
0.553 > next build
0.553
1.204 Attention: Next.js now collects completely anonymous telemetry regarding usage.
1.204 This information is used to shape Next.js' roadmap and prioritize features.
1.205 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
1.205 https://nextjs.org/telemetry
1.205
1.271   β–² Next.js 14.2.15
1.271   - Environments: .env
1.271
1.331    Creating an optimized production build ...
31.79  βœ“ Compiled successfully
31.79    Skipping linting
31.79    Checking validity of types ...
36.62    Collecting page data ...
38.41    Generating static pages (0/15) ...
38.64    Generating static pages (3/15)
38.74 Get request failed TypeError: fetch failed
38.74     at Object.fetch (node:internal/deps/undici/undici:14152:11)
38.74     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
38.74     at async a (/app/build/server/app/(ee)/settings/logs/page.js:39:10791)
38.74     at async i (/app/build/server/app/(ee)/settings/logs/page.js:39:9587) {
38.74   cause: Error: connect ECONNREFUSED ::1:8000
38.74       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
38.74       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
38.74     errno: -111,
38.74     code: 'ECONNREFUSED',
38.74     syscall: 'connect',
38.74     address: '::1',
38.74     port: 8000
38.74   }
38.74 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant