atomicdata-dev/atomic-server

Template CLI doesn't see website resource

Closed this issue · 2 comments

I created a website using the template:
https://common.terraphim.io/drive/h6grD0ID/website
But cli still complains it doesn't see website resources:

pnpm create @tomic/template my-project --template sveltekit-site --server-url https://common.terraphim.io/drive/h6grD0ID/website
Folder already exists, Everything in the existing folder will be deleted. Continue? (y/n) y
Created template in /home/alex/projects/zestic-at/my-project
https://common.terraphim.io/drive/h6grD0ID/01j6zqa7qgamwh5960dzy99j70 j [Error]: Resource not found. Failed to retrieve locally: 'https://common.terraphim.io/drive/h6grD0ID/01j6zqa7qgamwh5960dzy99j70'
    at N.fetchResourceHTTP (file:///home/alex/.cache/pnpm/dlx/x5px4qg53nd5bimwc3gb4tc5pu/193d3ee8036-2a1f/node_modules/.pnpm/@tomic+lib@0.40.0/node_modules/@tomic/lib/dist/index.js:2244:125)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async br.fetchResourceFromServer (file:///home/alex/.cache/pnpm/dlx/x5px4qg53nd5bimwc3gb4tc5pu/193d3ee8036-2a1f/node_modules/.pnpm/@tomic+lib@0.40.0/node_modules/@tomic/lib/dist/index.js:2693:120)
    at async br.getResource (file:///home/alex/.cache/pnpm/dlx/x5px4qg53nd5bimwc3gb4tc5pu/193d3ee8036-2a1f/node_modules/.pnpm/@tomic+lib@0.40.0/node_modules/@tomic/lib/dist/index.js:2777:15)
    at async postProcess (file:///home/alex/.cache/pnpm/dlx/x5px4qg53nd5bimwc3gb4tc5pu/193d3ee8036-2a1f/node_modules/.pnpm/@tomic+create-template@0.40.0_@tomic+lib@0.40.0/node_modules/@tomic/create-template/bin/src/postprocess.js:13:22)
    at async file:///home/alex/.cache/pnpm/dlx/x5px4qg53nd5bimwc3gb4tc5pu/193d3ee8036-2a1f/node_modules/.pnpm/@tomic+create-template@0.40.0_@tomic+lib@0.40.0/node_modules/@tomic/create-template/bin/src/index.js:41:1 {
  type: 'NotFound'
}

I tried any combination of server URL - https://common.terraphim.io/ and https://common.terraphim.io/drive/h6grD0ID/ with no difference.
I also went and clicked on each class to make sure it's public.

It looks like your ontology doesn't exist or doesn't have public read rights. All resources created by the template need public access to work. Usually it's best to make the containing drive public but if you don't want that you'll have to make the generated website ontology and 'Site Data' folder public.

Also in your example you gave the wrong resource as server-url. It needs to be the drive, so:

pnpm create @tomic/template my-project --template sveltekit-site --server-url https://common.terraphim.io/drive/h6grD0ID/

Bug sill occurs after resources are public. This is related to #993 and will be fixed in next release (v0.41.0)