blockchain-certificates / blockcerts-verifier

A Blockcerts verifier and viewer
MIT License
65 stars 52 forks source link

JSON-LD Normalization Failed #1504

Open jDavid95 opened 10 months ago

jDavid95 commented 10 months ago

Hello,

I'm having issues with my application on my remote server (works on my local vm, thoe), specifically when verifying. The verifier won't get pass the Computing local hash step. Not sure, what to share since I'm clueless of where the issue is coming from, but I can provide if necesary. The only thing I'm doing different is that I'm serving the module files from express and not using the plain <script type="module" src="node_modules/@blockcerts/blockcerts-verifier/dist/main.js"></script> tag, I would highly appreciate your help :)

(also I apoligize if this is not the right place for these kind of support)

jDavid95 commented 10 months ago

I have made several tests and found out that the only version I could run is 1.38.0 in an Ubuntu 20.04.6 server. Is this the desired behaviour for recent versions?

lemoustachiste commented 10 months ago

Hey sorry I missed the initial issue,

so let's rewind a little bit, what are you trying to accomplish? Serve the visual component for verification or just get the verification status of a blockcerts?

I'm serving the module files from express

Do you have an example of that?

At this point it's out of the use cases that we have designed this library for, so while I don't think it's expected to have an error with more recent versions, it is also not explicitly supported, but I'm happy to help you achieve this.

jDavid95 commented 10 months ago

So the goals are:

And the part where I'm serving the module files is this: app.use('/blockcerts-verifier', express.static(__dirname + '/node_modules/@blockcerts/blockcerts-verifier/dist/')); app.use('/webcomponentsjs', express.static(__dirname + '/node_modules/@webcomponents/webcomponentsjs/'));

And to give more context, this only seems to be an issue with Ubuntu server 20.04.6, because I've made it run and verify in Manjaro, Artix, and Ubuntu desktop.

Also, when trying to dockerize the web app with the most recent version (^1.57.2) the build fails when the npm install command gets executed, and gives the next error:

77.20 npm ERR! code 127 77.20 npm ERR! path /usr/src/app/node_modules/@blockcerts/cert-verifier-js-v1-legacy 77.20 npm ERR! command failed 77.20 npm ERR! command sh -c rimraf node_modules/jsonld/node_modules/xmldom && rimraf node_modules/rdf-canonize/node_modules/node-forge && rimraf node_modules/request/node_modules/tough-cookie 77.20 npm ERR! sh: 1: rimraf: not found this error disappeared when switching to the old version and building the image.

Sorry, if I'm all over the place, hope this clarifies my issue a bit better.

lemoustachiste commented 10 months ago

ok so I don't know about the ubuntu server part and honestly I won't be able to replicate and debug.

Have you tried to verify the certificate on blockcerts.org and does it verify as expected?

Docker may be a better approach indeed, the issue you are having requires you to add npm install -g rimraf before installing blockcerts-verifier. I am working on a way to remove that need but it's not yet ready to be published, so for the time being that is the solution to unblock you.

jDavid95 commented 10 months ago

Yes, I've verified certificates on the blockcerts.org and it verifies, so the certificates are fine.

Great! I will try that out and update this issue when I implement the docker version. As for now, I'll ship the verifier with the old version.

thank you 🤝

lemoustachiste commented 10 months ago

Good,

I find strange that the problem is with the actual verification and the jsonld normalization, and even more so that it verifies elsewhere.

It'd be good if youcould try and debug out the actual issue that triggers the jsonld normalization fail (it could be visible in your server logs).

By the way we also have the verifier available as a Docker image: https://github.com/blockchain-certificates/cvjs-docker/. That one just does the verification and does not offer a visual layer, but you could hack your way to display the certificate and call that verifier if that is also a solution.