Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing to Hypothesis fails with error "Annotations for this target URI are not allowed in this group" #6698

Closed
MihailGorceagEndava opened this issue Jun 3, 2021 · 1 comment

Comments

@MihailGorceagEndava
Copy link

url: https://api.hypothes.is/api/annotations
http method: POST
requestBody: {
uri: 'biorxiv url',
text: 'review text',
tags: ['tag name'],
permissions: {
read: ['group:q5X6RWJ6']
},
group: 'q5X6RWJ6'
}

Error text that we receive:
2021-06-02 16:34:11 }, error=function handleStreamError(err) {
2021-06-02 16:34:11 if (req.aborted) return;
2021-06-02 16:34:11 reject(enhanceError(err, config, null, lastRequest));
2021-06-02 16:34:11 }, _eventsCount=3, _maxListeners=undefined, $ref=$["error"]["request"]["socket"], $ref=$["error"]["request"]["socket"], httpVersionMajor=1, httpVersionMinor=1, httpVersion=1.1, complete=true, date=Wed, 02 Jun 2021 13:34:10 GMT, content-type=application/json, content-length=109, connection=close, content-security-policy=font-src 'self' fonts.gstatic.com cdn.hypothes.is; script-src 'self' cdn.hypothes.is www.google-analytics.com; style-src 'self' fonts.googleapis.com cdn.hypothes.is 'unsafe-inline', access-control-allow-origin=*, referrer-policy=origin-when-cross-origin, strict-origin-when-cross-origin, x-xss-protection=1; mode=block, cache-control=no-cache, cf-cache-status=DYNAMIC, cf-request-id=0a6e878ef80000594f820cb000000001, expect-ct=max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", strict-transport-security=max-age=15552000; includeSubDomains; preload, x-content-type-options=nosniff, server=cloudflare, cf-ray=65910ec4bccf594f-IAD, alt-svc=h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400, rawHeaders=[Date, Wed, 02 Jun 2021 13:34:10 GMT, Content-Type, application/json, Content-Length, 109, Connection, close, Content-Security-Policy, font-src 'self' fonts.gstatic.com cdn.hypothes.is; script-src 'self' cdn.hypothes.is www.google-analytics.com; style-src 'self' fonts.googleapis.com cdn.hypothes.is 'unsafe-inline', Access-Control-Allow-Origin, *, Referrer-Policy, origin-when-cross-origin, strict-origin-when-cross-origin, X-XSS-Protection, 1; mode=block, Cache-Control, no-cache, CF-Cache-Status, DYNAMIC, cf-request-id, 0a6e878ef80000594f820cb000000001, Expect-CT, max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct", Strict-Transport-Security, max-age=15552000; includeSubDomains; preload, X-Content-Type-Options, nosniff, Server, cloudflare, CF-RAY, 65910ec4bccf594f-IAD, alt-svc, h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400], , rawTrailers=[], aborted=false, upgrade=false, url=, method=null, statusCode=400, statusMessage=Bad Request, $ref=$["error"]["request"]["socket"], _consuming=false, _dumped=false, $ref=$["error"]["request"], responseUrl=https://api.hypothes.is/api/annotations, redirects=[], aborted=false, timeoutCb=null, upgradeOrConnect=false, parser=null, maxHeadersCount=null, reusedSocket=false, host=api.hypothes.is, protocol=https:, objectMode=false, highWaterMark=16384, finalCalled=false, needDrain=false, ending=false, ended=false, finished=false, destroyed=false, decodeStrings=true, defaultEncoding=utf8, length=0, writing=false, corked=0, sync=true, bufferProcessing=false, onwrite=function () { [native code] }, writecb=null, writelen=0, afterWriteTickInfo=null, bufferedRequest=null, lastBufferedRequest=null, pendingcb=0, prefinished=false, errorEmitted=false, emitClose=true, autoDestroy=false, bufferedRequestCount=0, next=null, entry=null, finish=function () { [native code] }, writable=true, response=function handleResponse(res) {
2021-06-02 16:34:11 if (req.aborted) return;
2021-06-02 16:34:11
2021-06-02 16:34:11 // uncompress the response body transparently if required
2021-06-02 16:34:11 var stream = res;
2021-06-02 16:34:11
2021-06-02 16:34:11 // return the last request in case of redirects
2021-06-02 16:34:11 var lastRequest = res.req || req;
2021-06-02 16:34:11
2021-06-02 16:34:11
2021-06-02 16:34:11 // if no content, is HEAD request or decompress disabled we should not decompress
2021-06-02 16:34:11 if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
2021-06-02 16:34:11 switch (res.headers['content-encoding']) {
2021-06-02 16:34:11 /eslint default-case:0/
2021-06-02 16:34:11 case 'gzip':
2021-06-02 16:34:11 case 'compress':
2021-06-02 16:34:11 case 'deflate':
2021-06-02 16:34:11 // add the unzipper to the body stream processing pipeline
2021-06-02 16:34:11 stream = stream.pipe(zlib.createUnzip());
2021-06-02 16:34:11
2021-06-02 16:34:11 // remove the content-encoding in order to not confuse downstream operations
2021-06-02 16:34:11 delete res.headers['content-encoding'];
2021-06-02 16:34:11 break;
2021-06-02 16:34:11 }
2021-06-02 16:34:11 }
2021-06-02 16:34:11
2021-06-02 16:34:11 var response = {
2021-06-02 16:34:11 status: res.statusCode,
2021-06-02 16:34:11 statusText: res.statusMessage,
2021-06-02 16:34:11 headers: res.headers,
2021-06-02 16:34:11 config: config,
2021-06-02 16:34:11 request: lastRequest
2021-06-02 16:34:11 };
2021-06-02 16:34:11
2021-06-02 16:34:11 if (config.responseType === 'stream') {
2021-06-02 16:34:11 response.data = stream;
2021-06-02 16:34:11 settle(resolve, reject, response);
2021-06-02 16:34:11 } else {
2021-06-02 16:34:11 var responseBuffer = [];
2021-06-02 16:34:11 stream.on('data', function handleStreamData(chunk) {
2021-06-02 16:34:11 responseBuffer.push(chunk);
2021-06-02 16:34:11
2021-06-02 16:34:11 // make sure the content length is not over the maxContentLength if specified
2021-06-02 16:34:11 if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
2021-06-02 16:34:11 stream.destroy();
2021-06-02 16:34:11 reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
2021-06-02 16:34:11 config, null, lastRequest));
2021-06-02 16:34:11 }
2021-06-02 16:34:11 });
2021-06-02 16:34:11
2021-06-02 16:34:11 stream.on('error', function handleStreamError(err) {
2021-06-02 16:34:11 if (req.aborted) return;
2021-06-02 16:34:11 reject(enhanceError(err, config, null, lastRequest));
2021-06-02 16:34:11 });
2021-06-02 16:34:11
2021-06-02 16:34:11 stream.on('end', function handleStreamEnd() {
2021-06-02 16:34:11 var responseData = Buffer.concat(responseBuffer);
2021-06-02 16:34:11 if (config.responseType !== 'arraybuffer') {
2021-06-02 16:34:11 responseData = responseData.toString(config.responseEncoding);
2021-06-02 16:34:11 if (!config.responseEncoding || config.responseEncoding === 'utf8') {
2021-06-02 16:34:11 responseData = utils.stripBOM(responseData);
2021-06-02 16:34:11 }
2021-06-02 16:34:11 }
2021-06-02 16:34:11
2021-06-02 16:34:11 response.data = responseData;
2021-06-02 16:34:11 settle(resolve, reject, response);
2021-06-02 16:34:11 });
2021-06-02 16:34:11 }
2021-06-02 16:34:11 }, error=function handleRequestError(err) {
2021-06-02 16:34:11 if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
2021-06-02 16:34:11 reject(enhanceError(err, config, null, req));
2021-06-02 16:34:11 }, _eventsCount=2, _maxListeners=undefined, maxRedirects=21, maxBodyLength=10485760, protocol=https:, path=/api/annotations, method=POST, $ref=$["error"]["config"]["headers"], agent=undefined, http=undefined, https=undefined, auth=undefined, hostname=api.hypothes.is, port=null, $ref=$["error"]["request"]["agent"]["sockets"]["api.hypothes.is:443::::::::::::::::::"][0]["parser"]["outgoing"]["_redirectable"]["_options"]["nativeProtocols"], pathname=/api/annotations, _ended=true, _ending=true, _redirectCount=0, $ref=$["error"]["request"]["res"]["redirects"], _requestBodyLength=151, _requestBodyBuffers=[], _onNativeResponse=function (response) {
2021-06-02 16:34:11 self._processResponse(response);
2021-06-02 16:34:11 }, $ref=$["error"]["request"], _currentUrl=https://api.hypothes.is/api/annotations, status=400, statusText=Bad Request, $ref=$["error"]["request"]["res"]["headers"], $ref=$["error"]["config"], $ref=$["error"]["request"], status=failure, reason=group scope: Annotations for this target URI are not allowed in this group, isAxiosError=true, toJSON=function toJSON() {
2021-06-02 16:34:11 return {
2021-06-02 16:34:11 // Standard
2021-06-02 16:34:11 message: this.message,
2021-06-02 16:34:11 name: this.name,
2021-06-02 16:34:11 // Microsoft
2021-06-02 16:34:11 description: this.description,
2021-06-02 16:34:11 number: this.number,
2021-06-02 16:34:11 // Mozilla
2021-06-02 16:34:11 fileName: this.fileName,
2021-06-02 16:34:11 lineNumber: this.lineNumber,
2021-06-02 16:34:11 columnNumber: this.columnNumber,
2021-06-02 16:34:11 stack: this.stack,
2021-06-02 16:34:11 // Axios
2021-06-02 16:34:11 config: this.config,
2021-06-02 16:34:11 code: this.code
2021-06-02 16:34:11 };
2021-06-02 16:34:11 }

Could you please tell us if we are doing something wrong, or maybe there is a misconfiguration on our Hypothesis account.
Yesterday we received such error, today publishing works ok.

@leedenison
Copy link

Closing due to lack of activity. If this continues to be an issue, please reopen with additional context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants