Unexpected token < in JSON at position 0 #571

Closed
opened 2026-02-04 21:36:31 +03:00 by OVERLORD · 10 comments
Owner

Originally created by @jkalousek on GitHub (Jan 18, 2020).

Subject of the issue

When I try to add anything into Organisation I get error "Unexpected token < in JSON at position 0" when I import items they are blank. Normal (personal vault) is working correctly.
I tried removing DB and starting fresh multiple times.

Your environment

  • Bitwarden_rs version: 1.13.1-c0ba3406 (both latest and alpine)
  • Install method: Docker-Compose
  • Clients used: Browser
  • Reverse proxy and version: External Reverse proxy (Apache)
  • Other relevant information:

config.json:

{
  "domain": "<REDACTED>",
  "disable_icon_download": false,
  "signups_allowed": false,
  "signups_verify": true,
  "signups_verify_resend_time": 3600,
  "signups_verify_resend_limit": 6,
  "invitations_allowed": true,
  "password_iterations": 100000,
  "show_password_hint": false,
  "admin_token": "<REDACTED>",
  "ip_header": "X-Real-IP",
  "icon_cache_ttl": 2592000,
  "icon_cache_negttl": 259200,
  "icon_download_timeout": 10,
  "icon_blacklist_non_global_ips": true,
  "disable_2fa_remember": false,
  "authenticator_disable_time_drift": false,
  "require_device_email": false,
  "reload_templates": false,
  "disable_admin_token": false,
  "_enable_yubico": true,
  "yubico_client_id": "<REDACTED>",
  "yubico_secret_key": "<REDACTED>",
  "_enable_duo": false,
  "_enable_smtp": true,
  "smtp_host": "<REDACTED>",
  "smtp_ssl": true,
  "smtp_explicit_tls": false,
  "smtp_port": 587,
  "smtp_from": "<REDACTED>",
  "smtp_from_name": "<REDACTED>",
  "smtp_username": "<REDACTED>",
  "smtp_password": "<REDACTED>",
  "smtp_timeout": 15,
  "_enable_email_2fa": true,
  "email_token_size": 6,
  "email_expiration_time": 600,
  "email_attempts_limit": 3
}

docker compose:

  bitwarden:
    container_name: bitwarden
    image: bitwardenrs/server:latest
    restart: always
    volumes:
      - /docker-data/bw-data:/data
    ports:
      - 88:80
      - 3012:3012
    environment:
      - WEBSOCKET_ENABLED=true
      - LOG_FILE=/data/bitwarden.log
      - LOG_LEVEL=debug     
      - EXTENDED_LOGGING=true

JS Concole:

onloadwff.js:71 Uncaught TypeError: Cannot read property 'type' of undefined
    at setFieldValue (onloadwff.js:71)
    at HTMLFormElement.formKeydownListener (onloadwff.js:71)
setFieldValue @ onloadwff.js:71
formKeydownListener @ onloadwff.js:71
Utils.js:209 [2020-01-18T20:55:47.693Z] Information: WebSocket connected to wss://<REWDACTED>

Steps to reproduce

Create Organisation, + Add Item, insert any data, when Save is clicked Error message is displayed.

Expected behaviour

Item should be saved...

Relevant logs

There is nothing related in LOGS (LOG_LEVEL=debug, EXTENDED_LOGGING=true)

[2020-01-18 20:49:11][request][INFO] GET /api/organizations/078d4f0f-0ef1-44ac-88d1-5bbc424d614a/users
[2020-01-18 20:49:11][response][INFO] GET /api/organizations/<org_id>/users (get_org_users) => 200 OK
[2020-01-18 20:49:12][request][INFO] GET /api/organizations/078d4f0f-0ef1-44ac-88d1-5bbc424d614a/collections
[2020-01-18 20:49:12][response][INFO] GET /api/organizations/<org_id>/collections (get_org_collections) => 200 OK
[2020-01-18 20:49:12][request][INFO] GET /api/ciphers/organization-details?organizationId=078d4f0f-0ef1-4
[2020-01-18 20:49:12][response][INFO] GET /api/ciphers/organization-details?<data..> (get_org_details) => 200 OK
[2020-01-18 20:49:13][request][INFO] GET /alive
[2020-01-18 20:49:13][response][INFO] GET /alive (alive) => 200 OK
[2020-01-18 20:49:16][request][INFO] GET /
[2020-01-18 20:49:16][response][INFO] GET / (web_index) => 200 OK

image

Originally created by @jkalousek on GitHub (Jan 18, 2020). ### Subject of the issue When I try to add anything into Organisation I get error "Unexpected token < in JSON at position 0" when I import items they are blank. Normal (personal vault) is working correctly. I tried removing DB and starting fresh multiple times. ### Your environment * Bitwarden_rs version: 1.13.1-c0ba3406 (both latest and alpine) * Install method: Docker-Compose * Clients used: Browser * Reverse proxy and version: External Reverse proxy (Apache) * Other relevant information: **config.json:** ``` { "domain": "<REDACTED>", "disable_icon_download": false, "signups_allowed": false, "signups_verify": true, "signups_verify_resend_time": 3600, "signups_verify_resend_limit": 6, "invitations_allowed": true, "password_iterations": 100000, "show_password_hint": false, "admin_token": "<REDACTED>", "ip_header": "X-Real-IP", "icon_cache_ttl": 2592000, "icon_cache_negttl": 259200, "icon_download_timeout": 10, "icon_blacklist_non_global_ips": true, "disable_2fa_remember": false, "authenticator_disable_time_drift": false, "require_device_email": false, "reload_templates": false, "disable_admin_token": false, "_enable_yubico": true, "yubico_client_id": "<REDACTED>", "yubico_secret_key": "<REDACTED>", "_enable_duo": false, "_enable_smtp": true, "smtp_host": "<REDACTED>", "smtp_ssl": true, "smtp_explicit_tls": false, "smtp_port": 587, "smtp_from": "<REDACTED>", "smtp_from_name": "<REDACTED>", "smtp_username": "<REDACTED>", "smtp_password": "<REDACTED>", "smtp_timeout": 15, "_enable_email_2fa": true, "email_token_size": 6, "email_expiration_time": 600, "email_attempts_limit": 3 } ``` **docker compose:** ``` bitwarden: container_name: bitwarden image: bitwardenrs/server:latest restart: always volumes: - /docker-data/bw-data:/data ports: - 88:80 - 3012:3012 environment: - WEBSOCKET_ENABLED=true - LOG_FILE=/data/bitwarden.log - LOG_LEVEL=debug - EXTENDED_LOGGING=true ``` **JS Concole:** ``` onloadwff.js:71 Uncaught TypeError: Cannot read property 'type' of undefined at setFieldValue (onloadwff.js:71) at HTMLFormElement.formKeydownListener (onloadwff.js:71) setFieldValue @ onloadwff.js:71 formKeydownListener @ onloadwff.js:71 Utils.js:209 [2020-01-18T20:55:47.693Z] Information: WebSocket connected to wss://<REWDACTED> ``` ### Steps to reproduce Create Organisation, + Add Item, insert any data, when Save is clicked Error message is displayed. ### Expected behaviour Item should be saved... ### Relevant logs There is nothing related in LOGS (LOG_LEVEL=debug, EXTENDED_LOGGING=true) ``` [2020-01-18 20:49:11][request][INFO] GET /api/organizations/078d4f0f-0ef1-44ac-88d1-5bbc424d614a/users [2020-01-18 20:49:11][response][INFO] GET /api/organizations/<org_id>/users (get_org_users) => 200 OK [2020-01-18 20:49:12][request][INFO] GET /api/organizations/078d4f0f-0ef1-44ac-88d1-5bbc424d614a/collections [2020-01-18 20:49:12][response][INFO] GET /api/organizations/<org_id>/collections (get_org_collections) => 200 OK [2020-01-18 20:49:12][request][INFO] GET /api/ciphers/organization-details?organizationId=078d4f0f-0ef1-4 [2020-01-18 20:49:12][response][INFO] GET /api/ciphers/organization-details?<data..> (get_org_details) => 200 OK [2020-01-18 20:49:13][request][INFO] GET /alive [2020-01-18 20:49:13][response][INFO] GET /alive (alive) => 200 OK [2020-01-18 20:49:16][request][INFO] GET / [2020-01-18 20:49:16][response][INFO] GET / (web_index) => 200 OK ``` ![image](https://user-images.githubusercontent.com/8996764/72670273-fbc9a880-3a3b-11ea-8306-8086130ad594.png)
Author
Owner

@dani-garcia commented on GitHub (Jan 18, 2020):

It seems to work for me fine from Firefox, what browser are you using? Do you get any error in the browsers console (F12)?

@dani-garcia commented on GitHub (Jan 18, 2020): It seems to work for me fine from Firefox, what browser are you using? Do you get any error in the browsers console (F12)?
Author
Owner

@jkalousek commented on GitHub (Jan 18, 2020):

I'm using Vivaldi. I added JS output to my original post.

@jkalousek commented on GitHub (Jan 18, 2020): I'm using Vivaldi. I added JS output to my original post.
Author
Owner

@jkalousek commented on GitHub (Jan 19, 2020):

I tested same steps in standard chrome and I have same problem.

@jkalousek commented on GitHub (Jan 19, 2020): I tested same steps in standard chrome and I have same problem.
Author
Owner

@dani-garcia commented on GitHub (Jan 19, 2020):

Any extensions that could be affecting it? I don't see any onloadwff.js file in the web vault.

@dani-garcia commented on GitHub (Jan 19, 2020): Any extensions that could be affecting it? I don't see any onloadwff.js file in the web vault.
Author
Owner

@jkalousek commented on GitHub (Jan 19, 2020):

Any extensions that could be affecting it? I don't see any onloadwff.js file in the web vault.

I think that this one is coming from LastPass...

I tried same process in MS Edge which I do not use at all and it gave me another error

An error has occurred.
Čtení se nezdařilo. <- I switched UI to English but this error is still in my native language. In translation it means something like Reading Unsuccessful.

@jkalousek commented on GitHub (Jan 19, 2020): > Any extensions that could be affecting it? I don't see any onloadwff.js file in the web vault. I think that this one is coming from LastPass... I tried same process in MS Edge which I do not use at all and it gave me another error An error has occurred. Čtení se nezdařilo. <- I switched UI to English but this error is still in my native language. In translation it means something like Reading Unsuccessful.
Author
Owner

@jkalousek commented on GitHub (Jan 19, 2020):

I just tried to login into vault with my phone and I can add Item from there If Owner is Organisation. I can also do it from Web assuming that I'm on home screen and I add item from there with different owner. I can also view shared Items. But as soon as I go to Organisation page I cannot add or open anything.

@jkalousek commented on GitHub (Jan 19, 2020): I just tried to login into vault with my phone and I can add Item from there If Owner is Organisation. I can also do it from Web assuming that I'm on home screen and I add item from there with different owner. I can also view shared Items. But as soon as I go to Organisation page I cannot add or open anything.
Author
Owner

@jkalousek commented on GitHub (Jan 19, 2020):

While opening Items from Organisation page there is following JS console output:

core.js:15714 ERROR Error: Uncaught (in promise): SyntaxError: Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0
    at j (zone.js:831)
    at zone.js:741
    at o (main.30de2a4c072448d6accc.js:1)
    at t.invoke (zone.js:391)
    at Object.onInvoke (core.js:17289)
    at t.invoke (zone.js:390)
    at e.run (zone.js:150)
    at zone.js:889
    at t.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:17280)
@jkalousek commented on GitHub (Jan 19, 2020): While opening Items from Organisation page there is following JS console output: ``` core.js:15714 ERROR Error: Uncaught (in promise): SyntaxError: Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0 at j (zone.js:831) at zone.js:741 at o (main.30de2a4c072448d6accc.js:1) at t.invoke (zone.js:391) at Object.onInvoke (core.js:17289) at t.invoke (zone.js:390) at e.run (zone.js:150) at zone.js:889 at t.invokeTask (zone.js:423) at Object.onInvokeTask (core.js:17280) ```
Author
Owner

@jkalousek commented on GitHub (Jan 19, 2020):

If it helps, when I try to change collection on Item in organisation I get:

core.js:15714 ERROR Error: Uncaught (in promise): TypeError: Cannot set property 'collectionIds' of undefined
TypeError: Cannot set property 'collectionIds' of undefined
    at l.<anonymous> (collections.component.ts:60)
    at main.30de2a4c072448d6accc.js:1
    at Object.next (main.30de2a4c072448d6accc.js:1)
    at main.30de2a4c072448d6accc.js:1
    at new t (zone.js:910)
    at t (main.30de2a4c072448d6accc.js:1)
    at l.n.submit (main.30de2a4c072448d6accc.js:1)
    at Object.handleEvent (main.30de2a4c072448d6accc.js:1)
    at Object.handleEvent (core.js:23009)
    at Object.handleEvent (core.js:23554)
    at j (zone.js:831)
    at new t (zone.js:913)
    at t (main.30de2a4c072448d6accc.js:1)
    at l.n.submit (main.30de2a4c072448d6accc.js:1)
    at Object.handleEvent (main.30de2a4c072448d6accc.js:1)
    at Object.handleEvent (core.js:23009)
    at Object.handleEvent (core.js:23554)
    at cg (core.js:20458)
    at core.js:21948
    at t.i [as _next] (core.js:13516)
@jkalousek commented on GitHub (Jan 19, 2020): If it helps, when I try to change collection on Item in organisation I get: ``` core.js:15714 ERROR Error: Uncaught (in promise): TypeError: Cannot set property 'collectionIds' of undefined TypeError: Cannot set property 'collectionIds' of undefined at l.<anonymous> (collections.component.ts:60) at main.30de2a4c072448d6accc.js:1 at Object.next (main.30de2a4c072448d6accc.js:1) at main.30de2a4c072448d6accc.js:1 at new t (zone.js:910) at t (main.30de2a4c072448d6accc.js:1) at l.n.submit (main.30de2a4c072448d6accc.js:1) at Object.handleEvent (main.30de2a4c072448d6accc.js:1) at Object.handleEvent (core.js:23009) at Object.handleEvent (core.js:23554) at j (zone.js:831) at new t (zone.js:913) at t (main.30de2a4c072448d6accc.js:1) at l.n.submit (main.30de2a4c072448d6accc.js:1) at Object.handleEvent (main.30de2a4c072448d6accc.js:1) at Object.handleEvent (core.js:23009) at Object.handleEvent (core.js:23554) at cg (core.js:20458) at core.js:21948 at t.i [as _next] (core.js:13516) ```
Author
Owner

@jkalousek commented on GitHub (Jan 19, 2020):

Ok, I'm really sorry, I figured it out. I had RewriteRule for /admin that redirect anyone going through proxy to homepage as security measure. This aperantly affect something on organisation page. I change it to be more specific and not It does work.

@jkalousek commented on GitHub (Jan 19, 2020): Ok, I'm really sorry, I figured it out. I had RewriteRule for /admin that redirect anyone going through proxy to homepage as security measure. This aperantly affect something on organisation page. I change it to be more specific and not It does work.
Author
Owner

@HenryKleinschmidt commented on GitHub (May 18, 2021):

Ok, I'm really sorry, I figured it out. I had RewriteRule for /admin that redirect anyone going through proxy to homepage as security measure. This aperantly affect something on organisation page. I change it to be more specific and not It does work.

Hi @jkalousek, I'm having the same issue right now. But I cant seem to get it working. Could you share your redirect rule?
I have this currently in my Ngninx Proxy conf but it causes the issue above..
location ~ /(admin) {
return 301 https://bitwarden.domain.com/#/;
}

@HenryKleinschmidt commented on GitHub (May 18, 2021): > Ok, I'm really sorry, I figured it out. I had RewriteRule for /admin that redirect anyone going through proxy to homepage as security measure. This aperantly affect something on organisation page. I change it to be more specific and not It does work. Hi @jkalousek, I'm having the same issue right now. But I cant seem to get it working. Could you share your redirect rule? I have this currently in my Ngninx Proxy conf but it causes the issue above.. `location ~ /(admin) {` ` return 301 https://bitwarden.domain.com/#/;` `}`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#571