drodil / backstage-plugin-qeta

Backstage.io plugin for Q&A
https://www.npmjs.com/package/@drodil/backstage-plugin-qeta
MIT License
86 stars 28 forks source link

Unexpected end of JSON input #92

Closed sebaespinosa closed 1 year ago

sebaespinosa commented 1 year ago

Hey,

I successfully install and config the plugin, but I'm getting a error "Unexpected end of JSON input"

I'm using Node v18.17.1 and haven't been able to find how to debug and collect more information.

image
drodil commented 1 year ago

Seems to be problem with the backend, do you get any errors in the log while starting?

sebaespinosa commented 1 year ago

Not really, here is a copy of the output logs when "yarn dev" onlye some warnings from other plugins configurations

` [0] Loaded config from app-config.yaml, app-config.local.yaml [0] Browserslist: caniuse-lite is outdated. Please run: [0] npx update-browserslist-db@latest [0] Why you should do it regularly: https://github.com/browserslist/update-db#readme [0] [webpack-dev-server] Project is running at:

[0] [webpack-dev-server] Content not from webpack is served from '/Users/sebaespinosa/GitHubs/BiceVida/bicevida-developer-portal-core/packages/app/public' directory [0] [webpack-dev-server] 404s will fallback to '/index.html' [1] Build succeeded [0] [webpack-dev-middleware] wait until bundle finished: /catalog?filters%5Bkind%5D=component&filters%5Buser%5D=all [1] 2023-09-22T14:52:15.736Z backstage info You are running an example backend, which is supposed to be mainly used for contributing back to Backstage. Do NOT deploy this to production. Read more here https://backstage.io/docs/getting-started/ [1] Loaded config from app-config.yaml, app-config.local.yaml [1] 2023-09-22T14:52:17.170Z backstage info Found 4 new secrets in config that will be redacted [1] 2023-09-22T14:52:17.180Z backstage info Created UrlReader predicateMux{readers=azure{host=dev.azure.com,authed=false},bitbucketCloud{host=bitbucket.org,authed=false},github{host=github.com,authed=false},gitlab{host=gitlab.com,authed=true},awsS3{host=amazonaws.com,authed=false},fetch{} [1] 2023-09-22T14:52:17.194Z catalog info Performing database migration type=plugin [1] 2023-09-22T14:52:17.256Z code-coverage info Initializing Code Coverage backend type=plugin [1] 2023-09-22T14:52:17.263Z rollbar warn Failed to initialize rollbar backend, set rollbar.accountToken in config to start the API. type=plugin [1] 2023-09-22T14:52:17.277Z backstage info Task worker starting: close_stale_tasks, {"version":2,"cadence":"/5 ","timeoutAfterDuration":"PT15M"} type=taskManager task=close_stale_tasks [1] 2023-09-22T14:52:17.290Z backstage info Task worker starting: entityOwnershipFactRetriever, {"version":2,"cadence":"1 1 1 ","initialDelayDuration":"PT5S","timeoutAfterDuration":"PT5M"} type=taskManager task=entityOwnershipFactRetriever [1] 2023-09-22T14:52:17.291Z backstage info Task worker starting: entityMetadataFactRetriever, {"version":2,"cadence":"1 1 1 ","initialDelayDuration":"PT5S","timeoutAfterDuration":"PT5M"} type=taskManager task=entityMetadataFactRetriever [1] 2023-09-22T14:52:17.291Z backstage info Task worker starting: techdocsFactRetriever, {"version":2,"cadence":"1 1 1 *","initialDelayDuration":"PT5S","timeoutAfterDuration":"PT5M"} type=taskManager task=techdocsFactRetriever [1] 2023-09-22T14:52:17.291Z tech-insights info Scheduled 3/3 fact retrievers into the tech-insights engine type=plugin [1] 2023-09-22T14:52:17.321Z tech-insights info Fact checker configured. Enabling fact checking endpoints. type=plugin [1] 2023-09-22T14:52:17.322Z auth info Configuring "database" as KeyStore provider type=plugin [1] 2023-09-22T14:52:17.331Z search info Added DefaultCatalogCollatorFactory collator factory for type software-catalog type=plugin [1] 2023-09-22T14:52:17.331Z search info Added DefaultTechDocsCollatorFactory collator factory for type techdocs type=plugin [1] 2023-09-22T14:52:17.331Z search info Added ToolDocumentCollatorFactory collator factory for type tools type=plugin [1] 2023-09-22T14:52:17.331Z search info Starting all scheduled search tasks. type=plugin [1] 2023-09-22T14:52:17.333Z techdocs info Creating Local publisher for TechDocs type=plugin [1] 2023-09-22T14:52:17.336Z kubernetes info Initializing Kubernetes backend type=plugin [1] 2023-09-22T14:52:17.336Z kubernetes warn Failed to initialize kubernetes backend: kubernetes config is missing type=plugin [1] 2023-09-22T14:52:17.336Z kafka info Initializing Kafka backend type=plugin [1] 2023-09-22T14:52:17.372Z jenkins warn PermissionAuthorizer is deprecated. Please use an instance of PermissionEvaluator instead of PermissionAuthorizer in PluginEnvironment#permissions type=plugin [1] 2023-09-22T14:52:17.372Z permission warn Permission backend started with permissions disabled. Enable permissions by setting permission.enabled=true. type=plugin [1] 2023-09-22T14:52:17.372Z playlist info Initializing Playlist backend type=plugin [1] 2023-09-22T14:52:17.377Z backstage info Task worker starting: search_index_software_catalog, {"version":2,"cadence":"PT10M","initialDelayDuration":"PT3S","timeoutAfterDuration":"PT15M"} type=taskManager task=search_index_software_catalog [1] 2023-09-22T14:52:17.378Z backstage info Task worker starting: search_index_techdocs, {"version":2,"cadence":"PT10M","initialDelayDuration":"PT3S","timeoutAfterDuration":"PT15M"} type=taskManager task=search_index_techdocs [1] 2023-09-22T14:52:17.378Z backstage info Task worker starting: search_index_tools, {"version":2,"cadence":"PT10M","initialDelayDuration":"PT3S","timeoutAfterDuration":"PT15M"} type=taskManager task=search_index_tools [1] 2023-09-22T14:52:17.411Z backstage info Listening on :7007 [1] 2023-09-22T14:52:20.380Z search info Collating documents for software-catalog via DefaultCatalogCollatorFactory type=plugin documentType=software-catalog [1] 2023-09-22T14:52:20.386Z search info Collating documents for techdocs via DefaultTechDocsCollatorFactory type=plugin documentType=techdocs [1] 2023-09-22T14:52:20.388Z search info Collating documents for tools via ToolDocumentCollatorFactory type=plugin documentType=tools [1] 2023-09-22T14:52:20.389Z search info Starting collation of explore tools type=plugin [1] 2023-09-22T14:52:20.400Z backstage info ::1 - - [22/Sep/2023:14:52:20 +0000] "GET /api/catalog/entities?offset=0&limit=500 HTTP/1.1" 200 2 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" type=incomingRequest [1] 2023-09-22T14:52:20.402Z backstage info ::1 - - [22/Sep/2023:14:52:20 +0000] "GET /api/catalog/entities?filter=metadata.annotations.backstage.io%2Ftechdocs-ref&fields=kind,namespace,metadata.annotations,metadata.name,metadata.title,metadata.namespace,spec.type,spec.lifecycle,relations&offset=0&limit=500 HTTP/1.1" 200 2 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" type=incomingRequest [1] 2023-09-22T14:52:20.404Z search warn Index for software-catalog was not created: indexer received 0 documents type=plugin documentType=software-catalog [1] 2023-09-22T14:52:20.405Z search info Collating documents for software-catalog succeeded type=plugin documentType=software-catalog [1] 2023-09-22T14:52:20.406Z search warn Index for techdocs was not created: indexer received 0 documents type=plugin documentType=techdocs [1] 2023-09-22T14:52:20.406Z search info Collating documents for techdocs succeeded type=plugin documentType=techdocs [1] 2023-09-22T14:52:20.407Z backstage info ::1 - - [22/Sep/2023:14:52:20 +0000] "GET /api/explore/tools HTTP/1.1" 200 - "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" type=incomingRequest [1] 2023-09-22T14:52:20.408Z search info Finished collation of explore tools type=plugin [1] 2023-09-22T14:52:20.420Z search info Collating documents for tools succeeded type=plugin documentType=tools [1] 2023-09-22T14:52:22.292Z tech-insights info Retrieving facts for fact retriever entityOwnershipFactRetriever type=plugin [1] 2023-09-22T14:52:22.293Z tech-insights info Retrieving facts for fact retriever entityMetadataFactRetriever type=plugin [1] 2023-09-22T14:52:22.294Z tech-insights info Retrieving facts for fact retriever techdocsFactRetriever type=plugin [1] 2023-09-22T14:52:22.296Z backstage info ::1 - - [22/Sep/2023:14:52:22 +0000] "GET /api/catalog/entities?filter=kind=component,kind=domain,kind=system,kind=api,kind=resource,kind=template HTTP/1.1" 200 2 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" type=incomingRequest [1] 2023-09-22T14:52:22.297Z backstage info ::1 - - [22/Sep/2023:14:52:22 +0000] "GET /api/catalog/entities HTTP/1.1" 200 2 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" type=incomingRequest [1] 2023-09-22T14:52:22.297Z backstage info ::1 - - [22/Sep/2023:14:52:22 +0000] "GET /api/catalog/entities HTTP/1.1" 200 2 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" type=incomingRequest [1] 2023-09-22T14:52:22.298Z tech-insights info Stored 0 facts for fact retriever entityOwnershipFactRetriever in 0.0s type=plugin [1] 2023-09-22T14:52:22.300Z tech-insights info Stored 0 facts for fact retriever entityMetadataFactRetriever in 0.0s type=plugin [1] 2023-09-22T14:52:22.300Z tech-insights info Stored 0 facts for fact retriever techdocsFactRetriever in 0.0s type=plugin [0] webpack compiled successfully [1] 2023-09-22T14:52:28.992Z backstage info ::1 - - [22/Sep/2023:14:52:28 +0000] "GET /api/catalog/entities?filter=kind=group,relations.hasMember=user%3Adefault%2Fguest&fields=metadata,kind HTTP/1.1" 304 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:29.110Z backstage info ::1 - - [22/Sep/2023:14:52:29 +0000] "GET /api/catalog/entity-facets?facet=kind HTTP/1.1" 304 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:29.111Z backstage info ::1 - - [22/Sep/2023:14:52:29 +0000] "GET /api/catalog/entity-facets?facet=metadata.tags HTTP/1.1" 304 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:29.464Z backstage info ::1 - - [22/Sep/2023:14:52:29 +0000] "GET /api/catalog/entities?filter=kind=component HTTP/1.1" 304 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:29.533Z backstage info ::1 - - [22/Sep/2023:14:52:29 +0000] "GET /api/catalog/entity-facets?filter=kind=component&facet=spec.type HTTP/1.1" 304 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:29.535Z backstage info ::1 - - [22/Sep/2023:14:52:29 +0000] "GET /api/catalog/entity-facets?filter=kind=component&facet=metadata.tags HTTP/1.1" 304 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:45.714Z backstage info ::1 - - [22/Sep/2023:14:52:45 +0000] "GET /api/qeta/questions?limit=10&includeEntities=true&order=desc&orderBy=created&noAnswers=false&noCorrectAnswer=false&noVotes=false HTTP/1.1" 404 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:45.718Z backstage info ::1 - - [22/Sep/2023:14:52:45 +0000] "GET /api/qeta/questions/list/hot?limit=7 HTTP/1.1" 404 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:45.718Z backstage info ::1 - - [22/Sep/2023:14:52:45 +0000] "GET /api/qeta/questions/list/unanswered?limit=7 HTTP/1.1" 404 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest [1] 2023-09-22T14:52:45.718Z backstage info ::1 - - [22/Sep/2023:14:52:45 +0000] "GET /api/qeta/questions/list/incorrect?limit=7 HTTP/1.1" 404 - "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" type=incomingRequest `

drodil commented 1 year ago

That is interesting.. How about are you logged in as user or guest? The plugin requires a logged in user or configuration:

qeta:
  allowAnonymous: true

See the docs for other config options. This might explain the problem.

Also can you check what the response of the localhost:3000/api/qeta/questions is using browser Developer Tools?

sebaespinosa commented 1 year ago

Thanks for pointing me. Most probably it's a configuration problem since in a clean install I don't have problems at all, adding the plugin to my company Backstage is generating the Issue

Here is what I'm getting from developers tools and also a copy of my current local config.

image

image

app-config.local copy.txt

drodil commented 1 year ago

Looks like the backend is not configured properly to have router for Q&A -> thus 404 errors are returned from the router. Can you check once more your backend setup according to instructions?

drodil commented 1 year ago

Is this still valid or can we close this @sebaespinosa ?

sebaespinosa commented 1 year ago

hey, we can close it. Sorry for not responding sooner, we went for a clean install and no problem at all. Thanks!

-- Sebastián Espinosa www.sebaespinosa.com

On Mon, Oct 16, 2023 at 3:05 AM drodil @.***> wrote:

Is this still valid or can we close this @sebaespinosa https://github.com/sebaespinosa ?

— Reply to this email directly, view it on GitHub https://github.com/drodil/backstage-plugin-qeta/issues/92#issuecomment-1763855841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMPEB4K76MBZUFGSANFD5DX7TMCRANCNFSM6AAAAAA5CAS3RU . You are receiving this because you were mentioned.Message ID: @.***>