Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Cannot read properties of undefined (reading 'includes') #47

Open
rlisac opened this issue Sep 16, 2022 · 7 comments
Open

Cannot read properties of undefined (reading 'includes') #47

rlisac opened this issue Sep 16, 2022 · 7 comments
Labels
issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: v3-SQL to v4-SQL status: pending reproduction Waiting for free time to reproduce the issue, or more information

Comments

@rlisac
Copy link

rlisac commented Sep 16, 2022

Bug report

Required System information

  • Node.js version: 16.13.2
  • NPM version: 8.1.2
  • Source Strapi version: 3.6.8
  • Target Strapi version: 4.3.8
  • Source Database: mysql
  • Target Database: mysql
  • Operating system: OSX
  • Which script are you running: v3-sql-v4-sql

Describe the bug

When running the script, the script aborts with the following error:
const v3RelationTables = tables.filter((t) => t.includes("__"));
TypeError: Cannot read properties of undefined (reading 'includes')

Steps to reproduce the behavior

  1. Go to 'nvm use 16'
  2. Run $ yarn
  3. Run $ yarn start
  4. See error

Screenshots

issue_RLI

Code snippets

const v3RelationTables = tables.filter((t) => t.includes("__"));

Additional context

Before starting the script, I had to adjust certain columns in the table to be compliant with the snake_case.

@derrickmehaffy derrickmehaffy added issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: v3-SQL to v4-SQL status: pending reproduction Waiting for free time to reproduce the issue, or more information labels Sep 19, 2022
@jpizzati-uvl
Copy link

jpizzati-uvl commented Sep 27, 2022

I'm experiencing the same issue, apparently some tables are showing up as "undefined", which causes the the migration script to stop.

System information

  • Node.js version: 14.20.1
  • NPM version: 6.14.17
  • Source Strapi version: 3.6.8
  • Target Strapi version: 4.3.8
  • Source Database: mysql
  • Target Database: mysql
  • Operating system: OSX
  • Which script are you running: v3-sql-v4-sql

image

@jpizzati-uvl
Copy link

jpizzati-uvl commented Sep 27, 2022

It appear that this is a case issue. I was able to resolve this by renaming all instances of "table_name" to "TABLE_NAME", (3) in total and found in:

  • index.js
  • migrateComponents.js
  • relationHelpers.js

Screen Shot 2022-09-27 at 20 13 14

Screen Shot 2022-09-27 at 20 13 30

Screen Shot 2022-09-27 at 20 13 45

@martincapek
Copy link
Collaborator

martincapek commented Sep 30, 2022

Hi, what version of mysql (mariadb) are you using? I'm not able to reproduce this error. In the meantime I created fix in way you proposed viz #55

@jpizzati-uvl
Copy link

jpizzati-uvl commented Sep 30, 2022

I'm on version 2.18.1 (npm)

@martincapek
Copy link
Collaborator

And the database itself? Im using mariadb:10.5.8

@jpizzati-uvl
Copy link

mysql 8.0.28

@martincapek
Copy link
Collaborator

Okey, I will test it also on that, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: v3-SQL to v4-SQL status: pending reproduction Waiting for free time to reproduce the issue, or more information
Projects
Status: To be reviewed
Development

No branches or pull requests

4 participants