Why it gives 403 error in strapi sometime? - strapi

Problem statement: In strapi sometimes it is giving 403 error while getting content manager What will be the issue?
System Information
Strapi Version : Strapi 4
Operating System : Windows
Database : MySQL
Node Version : 16.15.1
NPM Version : 8.11.0
#strapi #strapi 4.0.5

Make sure the endpoint is either public or your authenticating as a user with a role that has sufficient permissions.

Related

Yarn add - Private package - 404 Not Found

I want to install a private package hosted on an internal Gitlab with Yarn.
So, I configured my .npmrc with this informations :
#mypackage:registry=https://gitlab.intra/api/v4/packages/npm/
//gitlab.intra/api/v4/projects/819/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/packages/npm/:_authToken=xxxxx
always-auth=true
When I attempt to install the package with yarn add #mypackage/lib-node-client, Yarn give me an error :
Trace:
Error: https://gitlab.intra/api/v4/projects/725/packages/npm/#mypackage/lib-node-common/-/#mypackage/lib-node-common-21.7.1.tgz: Request failed "404 Not Found"
at ResponseError.ExtendableBuiltin (/usr/lib/node_modules/yarn/lib/cli.js:696:66)
at new ResponseError (/usr/lib/node_modules/yarn/lib/cli.js:802:124)
at Request.<anonymous> (/usr/lib/node_modules/yarn/lib/cli.js:67062:16)
at Request.emit (node:events:369:20)
at Request.module.exports.Request.onRequestResponse (/usr/lib/node_modules/yarn/lib/cli.js:141640:10)
at ClientRequest.emit (node:events:369:20)
at HTTPParser.parserOnIncomingClient (node:_http_client:646:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:129:17)
at HTTPParser.execute (<anonymous>)
at TLSSocket.socketOnData (node:_http_client:512:22)
So, Yarn can't find the URL : https://gitlab.intra/api/v4/projects/725/packages/npm/#mypackage/lib-node-common/-/#mypackage/lib-node-common-21.7.1.tgz
If I try to get this on my browser, I can download the package...
If anyone can help me please, thank's for all :)
In your .npmrc file, you tell how to connect to GitLab for the project 819. The error is about the project 725. GitLab simply refuse the connexion.
Try with
#mypackage:registry=https://gitlab.intra/api/v4/packages/npm/
//gitlab.intra/api/v4/projects/725/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/projects/819/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/packages/npm/:_authToken=xxxxx
always-auth=true
We had a gitlab private package registry, and was constantly getting this error.
npm i #placeholder/package-name works fine, but yarn add #placeholder/package-name was giving 404 errors.
I tried all possible solutions listed on this thread. At last, there was a section in gitlab on troubleshooting yarn installation [1].
It said,
try adding this to your .npmrc file (and replace <your_token> with your personal access token or deploy token):
//gitlab.example.com/api/v4/projects/:_authToken=<your_token>
Our previous .npmrc looked like this
save-exact=true
unsafe-perm=true
#placeholder:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=${PLACEHOLDER_TOKEN}
With the above new line addition, it looked like this,
save-exact=true
unsafe-perm=true
#placeholder:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=${PLACEHOLDER_TOKEN}
//gitlab.com/api/v4/projects/:_authToken=${PLACEHOLDER_TOKEN}
With that addition, yarn add #placeholder/package-name worked fine.
[1] https://docs.gitlab.com/ee/user/packages/npm_registry/#error-running-yarn-with-the-package-registry-for-npm-registry
This should be the accepted answer. //gitlab.com/api/v4/projects/:_authToken=${PLACEHOLDER_TOKEN} Was the piece I was missing, which supercedes needing to list each project id as in Joel's answer.

Connecting a db2 database from a centos hosted laravel application

I'm trying to connect to a db2 database server (iseries ibm) from my laravel application (5.8). The application is running on a centos linux server.
I saw that db2 isn't in the 4 databases types listed here : https://laravel.com/docs/5.8/database#introduction.
So I tried to use that package https://github.com/cooperl22/laravel-db2 but I got the followings errors :
Undefined class constant 'I5_ATTR_DBC_SYS_NAMING'
And I've got the errors for 5 constants :
PDO::I5_ATTR_DBC_SYS_NAMING, PDO::I5_ATTR_COMMIT, PDO::I5_ATTR_JOB_SORT, PDO::I5_ATTR_DBC_LIBL, PDO::I5_ATTR_DBC_CURLIB.
Also, if I comment theses constants, I got this error :
`Syntax error: -104 [IBM][CLI Driver][AS] SQL0104N An unexpected token "<END-OF-STATEMENT>" was found following "". Expected tokens may include: "( + - ? : DAY INF NAN RID ROW RRN". SQLSTATE=42601 (SQLNumResultCols[-104] at /root/PDO_IBM-1.3.6/ibm_driver.c:153) (SQL: select * from )`
I'm using the db2_ibmi_ibm driver.
Here is my php info linked to the driver :
EDITED :
php version is 7.3.4
centos version is 7
Also I made a from scratch php script running and I can get the results from a query using the db2_connection method. So I'm pretty sure it's PDO related :-/
Ok I found the issue, my scheme and database were wrong, so the query wasn't correct.
The PDO constants are not needed in my case.
Thanks for your answers

Error when running `feathers generate authentication` for `RethinkDB`

I’m having issues when running feathers generate authentication with selecting rethinkdb as database.
Environment:
Mac OS X Sierra
feathers 2.2.3
npm 5.1.0
rethinkdb 2.3.5
Steps to reproduce:
I have up and running https://github.com/tenzan/feathers-chat.git
feathers generate authentication
Select Username + Password (Local)
What is the name of the user (entity) service? (users) <-- Enter
What kind of service is it? (Use arrow keys) ❯ RethinkDB <-- Enter
Output:
events.js:182
throw er; // Unhandled 'error' event
^
TypeError: Parameter "url" must be a string, not object
at Url.parse (url.js:102:11)
at Object.urlParse [as parse] (url.js:96:5)
at ConnectionGenerator._getConfiguration (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:46:24)
at ConnectionGenerator._writeConfiguration (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:103:32)
at ConnectionGenerator.writing (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:297:10)
at Object.<anonymous> (/usr/local/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:417:23)
at /usr/local/lib/node_modules/feathers-cli/node_modules/run-async/index.js:25:25
at Promise (<anonymous>)
at /usr/local/lib/node_modules/feathers-cli/node_modules/run-async/index.js:24:19
at /usr/local/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:418:9
I had same errors on different Mac PCs with same environment.
It's an issue with generator-feathers
Remove the rethinkdb object from config/default
will see if I can fix the main problem
Edit: Fixed

Not able to generate Angular app based on running business network

When trying to follow the instructions (https://fabric-composer.github.io/tasks/genapp.html) to generate an Angular app based on a running business network I'm getting a No bower.json present error, using the defaultProfile. It seems to generate a node_modules directory but it's empty, however no angular-app directory is created. I was able to get the app generated by pointing at an existing BNA file as outlined in step 2 of the document but wasn't ideal. Any idea of what mind be going on?
jdockter#ubuntu:~$ yo fabric-composer:angular
WARNING: No configurations found in configuration directory:/home/jdockter/config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
Welcome to the Angular2 skeleton app generator
? Do you want to connect to a running Business Network? Yes
? What is the name of the application you wish to generate?: angular-app
? Description of the application: Skeleton Fabric Composer Angular2 project
? Author name: Jon Dockter
? Author email: jdockter#us.ibm.com
? What is the Business Network Identifier?: labor-network-model
? What is the Connection Profile to use? defaultProfile
? Enrollment id: WebAppAdmin
? Enrollment Secret: DJY27pEnl16d
Configuring: angular-app
About to connect to a running business network
I'm all done. Running npm install && bower install for you to install the required dependencies. If this fails, try running the command yourself.
npm WARN enoent ENOENT: no such file or directory, open '/home/jdockter/package.json'
npm WARN jdockter No description
npm WARN jdockter No repository field.
npm WARN jdockter No README data
npm WARN jdockter No license field.
bower ENOENT No bower.json present
Complete
I created this defect to track this:
https://github.com/fabric-composer/fabric-composer/issues/206
Will update here as soon as we know more.
Thanks for the report.

Error while hosting CodeIgniter Framework to online server

I need to solve the below issue:
When I tried to hosting codeIgniter framework to my online server, this error occurred.
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/lviscomp/public_html/system/core/Output.php:528)
Filename: core/Common.php
Line Number: 573
Backtrace:
A PHP Error was encountered
Severity: Error
Message: XCache: Cannot init
Filename: Unknown
Line Number: 0
Backtrace:
I had the same xcache issue in my Laravel application. I resolved it by upgrading the PHP version.
I think this might help you as well.
Go to your cPanel
Go to software section and click "select PHP version"
Change your PHP version from "native" to 5.4 or 5.5 (It will give you a list of drivers with checkboxes)
Select Xcache and enable it
Save your settings as well as PHP version
I hope it will work.
For Above Error header information already sent...
Click here!
XCache: Cannot init
Try Disable XCACHE from the Php configuration..
if this doesn't work ..
I think this is a question for your host.

Resources