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

[bug] New STORE_DIR env var, causes double slashes in path #385

Closed
1 of 4 tasks
frenck opened this issue Jan 29, 2021 · 8 comments
Closed
1 of 4 tasks

[bug] New STORE_DIR env var, causes double slashes in path #385

frenck opened this issue Jan 29, 2021 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@frenck
Copy link

frenck commented Jan 29, 2021

Before submitting a bug please read: https://zwave-js.github.io/zwavejs2mqtt/#/troubleshooting/bug_report

Version

Build/Run method

  • Docker
  • PKG
  • Manually built (git clone - npm install - npm run build )
  • Home Assistant Add-on

zwavejs2mqtt version: 1.0.0-rc.1
zwavejs version: 6.1.0

Describe the bug

Set STORE_DIR to e.g., /data/store

Resulting get requests caused by frontend store feature:

2021-01-29 11:37:01.456 INFO APP: GET /api/store//data/store/settings.json 404 1.298 ms - 136 Error: Not Found at /opt/app.js:443:15 at Layer.handle [as handle_request] (/opt/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/opt/node_modules/express/lib/router/index.js:317:13) at /opt/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/opt/node_modules/express/lib/router/index.js:335:12) at next (/opt/node_modules/express/lib/router/index.js:275:10) at cors (/opt/node_modules/cors/lib/index.js:188:7) at /opt/node_modules/cors/lib/index.js:224:17 at originCallback (/opt/node_modules/cors/lib/index.js:214:15) at /opt/node_modules/cors/lib/index.js:219:13 at optionsCallback (/opt/node_modules/cors/lib/index.js:199:9) at corsMiddleware (/opt/node_modules/cors/lib/index.js:204:7) at Layer.handle [as handle_request] (/opt/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/opt/node_modules/express/lib/router/index.js:317:13) at /opt/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/opt/node_modules/express/lib/router/index.js:335:12)

Result: /api/store//data/store/settings.json

To Reproduce

See above.

Expected behavior

Not a 404

Additional context

Downstream issue: hassio-addons/addon-zwave-js-ui#4

Downstream code setting the store path:

https://github.com/hassio-addons/addon-zwavejs2mqtt/blob/265db1f06d1e6e7fb4162242195e3d98038c73df/zwavejs2mqtt/rootfs/etc/services.d/zwavejs2mqtt/run#L10

@frenck frenck added the bug Something isn't working label Jan 29, 2021
@robertsLando
Copy link
Member

robertsLando commented Jan 29, 2021

@frenck It's strange because the url seems malformed. The path provided in the api uses encodeURIComponent, but seems that is not correctly parsed.

Ref: https://github.com/zwave-js/zwavejs2mqtt/blob/master/src/apis/ConfigApis.js#L50

Could be it something related to the browser?

@robertsLando
Copy link
Member

Tested and it's working on my side:

2021-01-29 11:37:49.478 INFO APP: GET /api/store/%2Fzwavejs2mqtt%2Fstore%2Fdb1da8db.json 304 2.325 ms - -

@frenck
Copy link
Author

frenck commented Jan 29, 2021

Interesting, so somewhere along the reverse proxy path it may go south then?

I Will look further into this, do you mind keeping this open for now? I'll report back with more information, or close in case resolved.

@robertsLando
Copy link
Member

It may, yes.

@robertsLando
Copy link
Member

Sorry closed by error

@robertsLando
Copy link
Member

@frenck Did you fixed this? BTW I can confirm it's not on my side

@TheDK
Copy link

TheDK commented Mar 20, 2021

Just FYI: It is not fixed, workaround is downloading the files.

@robertsLando
Copy link
Member

@TheDK if you install z2m not with the addon it works. I tried to say this to @frenck, it’s not on my side, cannot reproduce it outside the addon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants