ReferenceError: Uncaught error: regeneratorRuntime is not defined #1

Closed
opened 2016-05-10 23:54:09 +00:00 by FoxMcCloudDX · 5 comments
FoxMcCloudDX commented 2016-05-10 23:54:09 +00:00 (Migrated from github.com)

Hello, When I try to access one of the endpoints created by the plugin, i get the following error 'ReferenceError: Uncaught error: regeneratorRuntime is not defined'. I suppose it is related to babel. Do I need to add any extra configuration to babel on my app to make the plugin work as it should?

Hello, When I try to access one of the endpoints created by the plugin, i get the following error 'ReferenceError: Uncaught error: regeneratorRuntime is not defined'. I suppose it is related to babel. Do I need to add any extra configuration to babel on my app to make the plugin work as it should?
mdibaiee commented 2016-05-11 04:26:38 +00:00 (Migrated from github.com)

Hey,

I had forgotten to require babel/polyfill if it's not already required. I just published an update with the fix. hapi-sequelize-crud@2.0.9

Hey, I had forgotten to require `babel/polyfill` if it's not already required. I just published an update with the fix. `hapi-sequelize-crud@2.0.9`
FoxMcCloudDX commented 2016-05-11 20:39:20 +00:00 (Migrated from github.com)

Ok! Thanks! It is working. Another question i would like to ask you is how the one-to-one and one-to-many relations should be defined in order for the crud to work because i'm having a problem with using the POST method for that:

let's say i have the following relations:
team.hasMany(players) player.belongsTo(team)

when i try to create a player with the POST '/team/{teamId}/player' i get the following error:

method is not a function at handler$ (.../hapi-sequelize-test/node_modules/hapi-sequelize-crud3/build/associations/one-to-one.js:120:45)

from what i could gather after looking at the code is that the problem comes from the getMethod() function from the utils.js because it is trying to get the method 'createplayer' from the model that is passed to the function which is the team model.

Is this related to the way you should define the relations? or are you creating these create functions when defining the relations?

Ok! Thanks! It is working. Another question i would like to ask you is how the one-to-one and one-to-many relations should be defined in order for the crud to work because i'm having a problem with using the POST method for that: let's say i have the following relations: `team.hasMany(players) player.belongsTo(team)` when i try to create a player with the POST '/team/{teamId}/player' i get the following error: `method is not a function at handler$ (.../hapi-sequelize-test/node_modules/hapi-sequelize-crud3/build/associations/one-to-one.js:120:45)` from what i could gather after looking at the code is that the problem comes from the getMethod() function from the utils.js because it is trying to get the method 'createplayer' from the model that is passed to the function which is the team model. Is this related to the way you should define the relations? or are you creating these create functions when defining the relations?
mdibaiee commented 2016-05-11 20:47:03 +00:00 (Migrated from github.com)

@FoxMcCloudDX
The methods should work fine if you define relations correctly.

See this file as an example of how I've defined my relations:
https://github.com/mdibaiee/teamline/blob/master/src/relations.js

I'm not really sure about your case, but it should work fine if you use Team.hasMany(Player) and Player.belongsTo(Team).

@FoxMcCloudDX The methods should work fine if you define relations correctly. See this file as an example of how I've defined my relations: https://github.com/mdibaiee/teamline/blob/master/src/relations.js I'm not really sure about your case, but it should work fine if you use `Team.hasMany(Player)` and `Player.belongsTo(Team)`.
FoxMcCloudDX commented 2016-05-24 00:30:01 +00:00 (Migrated from github.com)

Hello again! I noticed that on your latest fix to this issue you added require('babel/polyfill') instead of 'babel-polyfill' and neither one is a dependency for your project. is there a reason why you are usin the '/' instead of '-'? and would it be best to add the babel-polyfill to your package.json?

Hello again! I noticed that on your latest fix to this issue you added require('babel/polyfill') instead of 'babel-polyfill' and neither one is a dependency for your project. is there a reason why you are usin the '/' instead of '-'? and would it be best to add the babel-polyfill to your package.json?
mdibaiee commented 2016-05-24 13:36:36 +00:00 (Migrated from github.com)

@FoxMcCloudDX Hey! that's because we use babel@5, the reason being decorators. Decorators are disabled, pending proposal update in babel@6, and babel/polyfill is the way to go when using babel@5.

Ah, you're right, I had to add babel it to dependencies, and I just did (hapi-sequelize-crud@2.0.10). Thanks for noting!

@FoxMcCloudDX Hey! that's because we use babel@5, the reason being decorators. [Decorators are disabled, pending proposal update](http://babeljs.io/docs/plugins/preset-stage-1/) in babel@6, and `babel/polyfill` is the way to go when using babel@5. Ah, you're right, I had to add `babel` it to dependencies, and I just did (`hapi-sequelize-crud@2.0.10`). Thanks for noting!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: thereadme/hapi-sequelize-crud#1
No description provided.