Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'split' of undefined in Ubuntu #2826

Closed
Sharcoux opened this issue Jul 24, 2023 · 7 comments
Closed

TypeError: Cannot read property 'split' of undefined in Ubuntu #2826

Sharcoux opened this issue Jul 24, 2023 · 7 comments

Comments

@Sharcoux
Copy link

Is this a feature request or a bug?

Bug

What is the current behavior?

In Ubuntu, run web-ext run -p <any profile>. It should fail.

What is the expected or desired behavior?

Should run

Version information (for bug reports)

  • Firefox version: 115.0.1 (64 bits)
  • Your OS and version: Ubuntu 22.04
  • Paste the output of these commands:
node --version && npm --version && web-ext --version
v14.21.3
9.6.4

I opened an issue in firefox-profile-js this lib is depending upon that might be the culprit.

@Sharcoux
Copy link
Author

According to firefox-profile author, the issue might be that web-ext doesn't manage correctly the this reference, maybe calling the class without the new keyword. I see some manipulations in the current code that, indeed, could end up losing this to some other object. I'm not comfortable enough with web-ext to help further, though.

@rpl
Copy link
Member

rpl commented Aug 3, 2023

Hi @Sharcoux thanks for investigating this issue, would you be able to attach the full error stack? (eventually passing --verbose to the web-ext command if without it the error stack is omitted).

Don't worry if you are unable to, we will try to reproduce it locally and get the full error stack so that we can dig deeper into this issue.

@Sharcoux
Copy link
Author

Sharcoux commented Aug 3, 2023

Sure:

Running web extension from [...]
[...]/node_modules/firefox-profile/node_modules/ini/ini.js:67
  const lines = str.split(/[\r\n]+/g)
                    ^

TypeError: Cannot read property 'split' of undefined
    at Object.decode ([...]/node_modules/firefox-profile/node_modules/ini/ini.js:67:21)
    at ReadFileContext.callback ([...]/node_modules/firefox-profile/lib/profile_finder.js:57:24)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:282:13)
error Command failed with exit code 1.

@Rob--W
Copy link
Member

Rob--W commented Sep 28, 2023

The error is in firefox-profile: https://github.com/saadtazi/firefox-profile-js/blob/932b40ea8758f22b938af653709767e50a26b98d/lib/profile_finder.js#L55-L57

When reading the file fails (e.g. due to it not existing), supposedly a callback should be called with the error. At line 56, the logic should not only invoke the callback with the error, but also return. Not returning results in the next line trying to parse non-existing content, which results in the error seen above.

@saadtazi
Copy link

The error is in firefox-profile: https://github.com/saadtazi/firefox-profile-js/blob/932b40ea8758f22b938af653709767e50a26b98d/lib/profile_finder.js#L55-L57

When reading the file fails (e.g. due to it not existing), supposedly a callback should be called with the error. At line 56, the logic should not only invoke the callback with the error, but also return. Not returning results in the next line trying to parse non-existing content, which results in the error seen above.

@Rob--W I just published firefox-profile v4.4.0 that fixes the issue above. I hope this helps.

@willdurand
Copy link
Member

fixed by #2897

@Rob--W
Copy link
Member

Rob--W commented Sep 29, 2023

@Rob--W I just published firefox-profile v4.4.0 that fixes the issue above. I hope this helps.

Thanks for the update!

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

No branches or pull requests

5 participants