Getting "Cannot read property of undefined" when syncing

:wave: happy friday!

Getting this issue when syncing w/codegen for the first time:


make sure you’ve specified the importPath for your code components

Interesting. So I’m adding codegen to an existing project, and I generated plasmic.json automatically via CLI.

Does this mean I should add importPath manually to all existing code components?

Or can this be done globally?

sorry, I meant in your registerComponent() calls when you registered your code components


registerComponent(MyComponent, {
  name: "MyComponent",
  importPath: "..."

Yep, reading the docs now on that thanks.

@chungwu still happening - is there any way to get debug output? There are only 2 calls to registerComponent in the codebase

(lots of substituteComponent calls though)

Be sure to load the studio project again after you’ve updated the custom app host, so that Plasmic gets to see the new code component metadata

Should I be pointing the app host locally while doing this?

If no one else will be using the project :sweat_smile: once you point it back to the production host, the problem will occur again. So you should try to eventually make sure the correct registerComponent call is being made at whichever host you want the project to use long term.

Ah - I can make a copy of the studio project then, point it to the localhost, get codegen working, then deploy to prod and it’ll update the prod studio copy

yup - some notes here:

ty ty

ahhhh the error went away when I removed the --non-recursive flag. Could that have been it?

that’s surprising…