sealcode / sealious

An extensible, declarative node framework
25 stars 2 forks source link

Incorrect path to the uploaded file #299

Closed adwydman closed 6 years ago

adwydman commented 8 years ago

When I upload a file via Sealious, this is what's stored in the database:

[
  {
    "id": "513xy5wtsf",
    "type": "books",
    "body": {
      "author": "aaa",
      "title": "bbb",
      "year": null,
      "book": "/managed-files/wujkoj9n22/grid.html.zip"
    },
    "created_context": {
      "timestamp": 1473081891566,
      "ip": "127.0.0.1",
      "user_id": false
    }
  }
]

The path stored in the DB is /managed-files, but the directory in Sealious app is uploaded_files.

kuba-orlik commented 8 years ago

Try following the link. Does it work? :)

adwydman commented 8 years ago

Do you mean http://localhost/managed-files/wujkoj9n22/grid.html.zip? If yes then it doesn't work: {"statusCode":404,"error":"Not Found"}

kuba-orlik commented 8 years ago

What Sealious version are you on? I highly recommend using the alpha version right now:

npm install --save sealcode/sealious#alpha
adwydman commented 8 years ago

Right after the npm install --save sealcode/sealious#alpha:

$ node .
14:27:07.733 - info: Loading plugins...
14:27:07.823 - debug: sealious (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\package.
json) requires: sealious-datastore-tingo
14:27:08.998 - info:    ✓ sealious-datastore-tingo (C:\Users\anwi\Desktop\fka-bookshop\node_modul
es\sealious-datastore-tingo)
14:27:09.026 - debug: fka-bookshop (C:\Users\anwi\Desktop\fka-bookshop\package.json) requires: se
alious-channel-rest, sealious-datastore-mongo, sealious-www-server
14:27:09.030 - debug: sealious-channel-rest (C:\Users\anwi\Desktop\fka-bookshop\node_modules\seal
ious-channel-rest\package.json) requires: sealious-www-server
C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\chip-types\chip-manager.js:59
                if(chips[type][name]) throw Error(`Chip '${type}.${name}' already exists!`);
                                      ^

Error: Chip 'field_type.color' already exists!
    at Error (native)
    at Object.ChipManager.add_chip (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\
chip-types\chip-manager.js:59:31)
    at new FieldType (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\chip-types\fie
ld-type.js:35:15)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious-www-server\de
fine\field_type.color.js:5:24)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious-www-server\se
alious-www-server.js:4:1)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at load_plugins_from_dir (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\plugin
s\plugin-manager.js:58:5)
    at load_plugins_from_dir (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\plugin
s\plugin-manager.js:56:4)
    at Object.PluginManager.load_plugins (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealiou
s\lib\plugins\plugin-manager.js:75:3)
    at Object.Sealious.init (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\main.js
:52:25)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\index.js:2:10)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (node.js:348:7)
    at startup (node.js:140:9)
    at node.js:463:3
kuba-orlik commented 8 years ago

I think it means you're using an outdated sealious-www-server plugin (I think in the past the plugin contained the color field-type!)

rm -rf node_modules
npm install --save sealcode/sealious-www-server#alpha sealcode/sealious-channel-rest#alpha
npm install
adwydman commented 8 years ago

Another error:

$ node .
14:41:43.684 - info: Loading plugins...
14:41:43.828 - debug: sealious (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\package.
json) requires: sealious-datastore-tingo
14:41:44.677 - info:    ✓ sealious-datastore-tingo (C:\Users\anwi\Desktop\fka-bookshop\node_modul
es\sealious-datastore-tingo)
14:41:44.740 - debug: fka-bookshop (C:\Users\anwi\Desktop\fka-bookshop\package.json) requires: se
alious-channel-rest, sealious-datastore-mongo, sealious-www-server
14:41:44.753 - debug: sealious-channel-rest (C:\Users\anwi\Desktop\fka-bookshop\node_modules\seal
ious-channel-rest\package.json) requires: sealious-www-server
14:41:46.063 - info:    ✓ sealious-www-server (C:\Users\anwi\Desktop\fka-bookshop\node_modules\se
alious-channel-rest\node_modules\sealious-www-server)
14:41:46.087 - info:    ✓ sealious-channel-rest (C:\Users\anwi\Desktop\fka-bookshop\node_modules\
sealious-channel-rest)
{ Error: Cannot find module '../build/Release/bson'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\node_modules\bson\ext\index.js:15:1
0)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\node_modules\bson\lib\bson\index.js
:3:24)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\node_modules\mongodb\lib\mongodb\in
dex.js:2:22)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious-datastore-mon
go\index.js:3:15)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at load_plugins_from_dir (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\plugin
s\plugin-manager.js:58:5)
    at Object.PluginManager.load_plugins (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealiou
s\lib\plugins\plugin-manager.js:75:3)
    at Object.Sealious.init (C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\main.js
:52:25)
    at Object.<anonymous> (C:\Users\anwi\Desktop\fka-bookshop\index.js:2:10) code: 'MODULE_NOT_FO
UND' }
js-bson: Failed to load c++ bson extension, using pure JS version
14:41:47.607 - info:    ✓ sealious-datastore-mongo (C:\Users\anwi\Desktop\fka-bookshop\node_modul
es\sealious-datastore-mongo)
14:41:47.640 - info:    sealious-www-server (already loaded)

C:\Users\anwi\Desktop\fka-bookshop\node_modules\sealious\lib\chip-types\chip-manager.js:139
                                throw Errors.Error("Chip manager was requested to return a datast
ore chip. Multiple chips of type `datastore` have been registered, and no default provided in con
figuration.");
                                ^
 undefined
kuba-orlik commented 8 years ago

Add this before Sealious.init():

Sealious.ConfigManager.set_config("datastore_chip_name", "mongo");
kuba-orlik commented 8 years ago

Did it work? :)

adwydman commented 8 years ago

Yes, now it works. :)

adwydman commented 8 years ago

Now that I'm using new Sealious version, this is what I get when I want to GET a resource from db:

{
  "message": "No child subject with key 'books' in RootSubject",
  "type": "bad_subject",
  "data": {}
}
kuba-orlik commented 8 years ago

what path are you GETing? Should be /api/v1/collections/books/:id

kuba-orlik commented 6 years ago

Issues moved do Sealcode's phabricator: https://hub.sealcode.org/project/view/11/