clockify / browser-extension

Clockify Browser Extension
https://clockify.me/chrome-time-tracking
BSD 3-Clause "New" or "Revised" License
183 stars 172 forks source link

environment.webSocket is undefined - Trying to add integration for plutio.com #127

Closed Amjad992 closed 3 years ago

Amjad992 commented 3 years ago

Hello guys,

I am trying to add an integration for a project management software called plutio.com

I have Node: version 12.16.1 I have NPM: version 6.14.3 I installed Ruby with development kit: version 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32] I installed Compass: version 1.0.3 (Polaris)

I built the chrome and firefox extensions following the instructions in the readme file (npm run compile.dev.chrome and npm run compile.dev.firefox), it all went smoothly without any errors

When I load the extensions in the browsers it shows me errors of undefined value

1) In chrome it shows Uncaught TypeError: Cannot read property 'endpoint' of undefined for the setWebSocketParamsToStorage function in src/application.js file

2) In firefox it shows Uncaught TypeError: environment.webSocket is undefined for the same function in application.js file

The lines that causes the errors are localStorageService.set( "webSocketEndpoint", environment.webSocket.endpoint,getLocalStorageEnums().PERMANENT_PREFIX); localStorageService.set("webSocketClientId",environment.webSocket.clientId,getLocalStorageEnums().PERMANENT_PREFIX);

When I tracked the environment.webSocket object, I found it returned from src/environment.dev.js and it has the value of

{
    production: true,
    endpoint: 'https://global.api.clockify.me',
    home: 'https://clockify.me',
    signUp: 'https://clockify.me/signup',
    resetPassword: 'https://clockify.me/reset-password',
    startButton:'START',
    stopButton:'STOP',
    terms: 'https://clockify.me/terms',
    webClientId: 'yout-clientIt-from-google-api-console',
    redirectUriOauthChromeExtension: "login/extension/chrome/oauth2",
    redirectUriOauthFirefoxExtension: "login/extension/firefox/oauth2"
}

What I am missing here please, isn't there supposed to be a value for the webSocket in the environment? am I supposed to provide that myself or what and also am I supposed to create an app or something on google console?!

https://www.loom.com/share/7bb34debea8b4b03bd3f4f53a1ba60b9

Thank you

aleksandar-olic commented 3 years ago

production code and github code wasn't synced, maybe that's why it didn't work. could you pull the latest changes and try again?

Amjad992 commented 3 years ago

@aleksandar-olic

I have pulled the changes and now it's working fine, however, it's throwing another set of errors (although I faced no issues yet because of these, I'll add the screenshot just for reference for the team if needed and I'll be closing the issue)

Thank you

errors

aleksandar-olic commented 3 years ago

Hm, we haven't noticed this. Could you try removing unsafe-eval from the manifest file and see if that may help?

Amjad992 commented 3 years ago

it doesn't seem to make a difference in terms of removing the errors and warning

attached below screenshots of the errors

Firefox: firefox

Chrome: chrome1 chrome2 chrome3 In Chrome all the errors are in these 2 lines chromeA chromeB

and by the way as you already know your live extension has none of these errors or warnings