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

Unexpected token ) in company.js file #154

Closed
BrownieBits opened this issue Jan 26, 2019 · 5 comments
Closed

Unexpected token ) in company.js file #154

BrownieBits opened this issue Jan 26, 2019 · 5 comments

Comments

@BrownieBits
Copy link

I am trying to deploy a project to cloud functions. i switched from TS to JS to try to get better usability with this and other packages. But every time I add const Hubspot = require('hubspot'); I get an error on deployment that halts everything.

Is there a syntax error in your code?
Detailed stack trace: /user_code/node_modules/hubspot/lib/company.js:89
)
^

SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/user_code/node_modules/hubspot/lib/client.js:3:17)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)

@AustinLeeGordon
Copy link
Contributor

Same issue as #151. Seems that the prettier trailingComma needs to be changed to none or es5.

addContactToCompany(data) {
if (!data || !data.companyId || !data.contactVid) {
return Promise.reject(
new Error('companyId and contactVid params must be provided'),
)
}

@BrownieBits
Copy link
Author

So is there a way I can get around this so I can deploy my code? Implementing a connection to HubSpot is the last part of a project and this is my roadblock. I tried removing the comma on my local code but still get the error...

@AustinLeeGordon
Copy link
Contributor

@PrimalIan I just changed the prettier config in my PR - #152. For now you can try installing and using my fork of it until #152 is merged or another PR fixes it. To install my fork, run npm install --save https://github.com/AustinLeeGordon/node-hubspot.

@BrownieBits
Copy link
Author

@AustinLeeGordon looks like we were able to move past the prettier issue but now it is telling me there is another error...which i believe is another prettier issue

Detailed stack trace: /user_code/node_modules/hubspot/lib/oauth.js:12
...data,
^^^

SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)

@AustinLeeGordon
Copy link
Contributor

@PrimalIan haha, that sounds about right.

That has to do with ES6 support in node, so prettier wouldn’t be able to fix that. What version of node are you using?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants