主页 > app >
部署在Google App Engine上的Strapi无法看到刚通过Strapi Provider for Google Storage上传的图像
25-05-02
1
在本文中,我们将详细介绍部署在GoogleAppEngine上的Strapi无法看到刚通过StrapiProviderforGoogleStorage上传的图像的各个方面,同时,我们也将为您带来关于A
在本文中,我们将详细介绍部署在Google App Engine上的Strapi无法看到刚通过Strapi Provider for Google Storage上传的图像 的各个方面,同时,我们也将为您带来关于ActionController :: RoutingError没有路由与[GET]“ / vendor / assets / stylesheets / bootstrap.min.css”匹配 app / assets / stylesheets / application.css: app / assets / javascript / application.js: app / views / layout / application.html.erb: app / j、angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在、App Module Provider 抛出 NullInjectorError: No provider for InjectionToken MSAL_GUARD_CONFIG、c# – 在Sql Server连接字符串中使用Encrypt = yes – >“provider:SSL Provider,error:0 – 证书的CN名称与传递的值不匹配. 的有用知识。
本文目录一览:
部署在Google App Engine上的Strapi无法看到刚通过Strapi Provider for Google Storage上传的图像 如何解决部署在Google App Engine上的Strapi无法看到刚通过Strapi Provider for Google Storage上传的图像 帮助!!!我正在将STradi部署到GAE。现在的问题是我看不到上传的图片...因此,尽管我可以上传图片并通过转到以下位置查看图片是否正确上传,但我还是使用了https://github.com/Lith/strapi-provider-upload-google-cloud-storage/blob/master/README.md文档中推荐的提供程序:云存储界面,实际上看到那里的图像,我无法访问它们。我已经将Storage Admin和Storage Object Admin都授予了帐户服务,还为其创建了密钥,但是仍然无法获取我刚刚上传的图像...出现403错误...是否有人遇到过这种情况?>
这是我的plugins.js文件:
module.exports = { upload: { provider: ''google-cloud-storage'',providerOptions: { bucketName: ''strapi-sqlite-post.appspot.com'',publicFiles: false,uniform: false,basePath: '''' },} }
在此处输入图片描述
解决方法
我建议您遵循Strapi的官方文档:
Google App Engine Strapi
在本指南中,您将要:
1.Create a new Strapi project
2.Configure PostgreSQL for the production enviroment
3.Deploy the app to Google App Engine
4.Add the Google Cloud Storage file uploading plugin by @Lith
,
我还没有检查过,但是可能您应该更改
publicFiles: false
至publicFiles: true
?
,
即使将 public 设置为 true 我也遇到了这个问题,所以我将整个存储桶设置为 public。如果您只想将您打算向公众公开的媒体添加到您的 Strapi 媒体库中,这很好。
您可以通过在 GCS 控制台中导航到您的存储桶来执行此操作。转到权限 > 添加。在 NewMembers 字段中输入“allUsers”,然后在 Role 中选择 Google Storage > Storage Object Viewer。
ActionController :: RoutingError没有路由与[GET]“ / vendor / assets / stylesheets / bootstrap.min.css”匹配 app / assets / stylesheets / application.css: app / assets / javascript / application.js: app / views / layout / application.html.erb: app / j 如何解决ActionController :: RoutingError没有路由与[GET]“ / vendor / assets / stylesheets / bootstrap.min.css”匹配 app / assets / stylesheets / application.css: app / assets / javascript / application.js: app / views / layout / application.html.erb: app / j
我正在Rails上执行此应用程序,页面加载正常,但在控制台中显示:
Started GET "/vendor/assets/stylesheets/bootstrap.min.css" for ::1 at 2020-08-17 09:09:51 -0500
Started GET "/vendor/assets/javascripts/bootstrap.min.js" for ::1 at 2020-08-17 09:09:51 -0500
ActionController::RoutingError (No route matches [GET]
"/vendor/assets/stylesheets/bootstrap.min.css"):
ActionController::RoutingError (No route matches [GET]
"/vendor/assets/javascripts/bootstrap.min.js"):
在我的供应商文件夹中,我同时拥有文件夹,javascript和样式表,并分别位于各自的bootsrtrap.min中。 即使在application.html.erb中,我也有以下内容:
<link href="vendor/assets/stylesheets/bootstrap.min.css" rel="stylesheet">
<%= csrf_Meta_tags %>
<%= stylesheet_link_tag ''application'',media: ''all'',''data-turbolinks-track'': ''reload'' %>
<%= javascript_include_tag ''application'',''data-turbolinks-track'': ''reload'' %>
</head>
<body>
<!-- Navigation -->
<nav>
<div>
<ahref="#">Instagram Clone</a>
<buttontype="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span></span>
</button>
<divid="navbarResponsive">
<ul>
<li>
<ahref="#">Home
<span>(current)</span>
</a>
</li>
<li>
<ahref="#">About</a>
</li>
<li>
<ahref="#">Services</a>
</li>
<li>
<ahref="#">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page Content -->
<div>
<div>
<div>
<%= yield %>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript -->
<!--<script src="vendor/jquery/jquery.slim.min.js"></script>-->
<script src="vendor/assets/javascripts/bootstrap.min.js"></script>
</body>
</html>
在js和CSS这两个应用程序文件中,我都放置了“ require bootsrtrap.min”,即使该错误仍然出现在控制台中。 会是什么?
解决方法
RoR不使用目录作为文件夹结构指示。因为有资产装载者。您应该将5s或更少的css导入application.css中,并将js导入application.js中。并使用自己的助手添加捆绑文件:
1。用纱安装靴子
yarn add bootstrap @popperjs/core jquery
或
npm i bootstrap @popperjs/core jquery
栏位不超过5
2。在Assets Pipeline中导入文件
app / assets / stylesheets / application.css:
//...
require bootstrap/dist/css/bootstrap.min
//...
但是,如果需要,我建议使用SCSS并仅导入所需的样式。
app / assets / javascript / application.js:
//...
//= require jquery
//= require @popperjs/core
//= require bootstrap/dist/js/bootstrap.min
//...
3。在布局中导入资产
app / views / layout / application.html.erb:
<head>
...
<%= stylesheet_link_tag ''application'',media: ''all'' %>
</head>
<body>
...
<%= javascript_include_tag ''application'' %>
</body>
使用webpack滚动6
2。在application.scss和application.js中导入Bootstrap
app / javascript / stylesheets / application.scss:
//...
import ''bootstrap''
//...
app / javascript / packs / application.js:
import ''jquery''
import ''popper.js''
import ''bootstrap''
import ''../stylesheets/application''
3。在布局中导入捆绑包
<head>
...
<%= stylesheet_pack_tag ''application'',media: ''all'',''data-turbolinks-track'': ''reload'' %>
<%= javascript_pack_tag ''application'',''data-turbolinks-track'': ''reload'' %>
</head>
之后,您应该可以在所有应用程序中使用引导程序!
,
[解决方案]因此,在我的HTML(application.html.erb)内部,我有两个对js和css文件的调用:
<script src="assets/javascripts/bootstrap.min.js"></script>
<%= javascript_include_tag ''application'',''data-turbolinks-track'': ''reload'' %>
<link href="assets/stylesheets/bootstrap.min.css" rel="stylesheet">
<%= csrf_meta_tags %>
<%= stylesheet_link_tag ''application'',''data-turbolinks-track'':
''reload'' %>
正如您在上面看到的那样,在使用javascript的情况下,我有一个使用脚本的调用,而另一个使用了的调用,两者都造成了问题,所以您只需要评论一个,我就对该脚本进行评论对于我的java文件和CSS文件,一个。 像这样:
<!--<link href="assets/stylesheets/bootstrap.min.css" rel="stylesheet">-->
<!--<script src="assets/javascripts/bootstrap.min.js"></script>-->
对我来说,解决了这个问题,我真的尝试了所有事情,这就是解决方案哈哈。
angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在
我在角度创建新项目时面临问题.
当我运行新的myapp命令时,我得到以下命令
新的你好
Error: Path "/app/app.module.ts" does not exist.
Path "/app/app.module.ts" does not exist.
谁能帮我吗???
解决方法
这是解决方案
Please make sure that your new folder have write permission
如果您使用的是ubuntu,请将以下命令运行到该文件夹
sudo chmod 644 -R foldername
然后运行新的appname
并检查您的节点版本
App Module Provider 抛出 NullInjectorError: No provider for InjectionToken MSAL_GUARD_CONFIG 如何解决App Module Provider 抛出 NullInjectorError: No provider for InjectionToken MSAL_GUARD_CONFIG 我有这样的配置包装器用于 Azure AD 身份验证
import { APP_INITIALIZER , InjectionToken , NgModule } from ''@angular/core'' ;
import { LogLevel , Con fig uration , bro wserCacheLocation , In tera ctionType , IPubli ccl ientApplication , Publi ccl ientApplication } from ''@azure/msal- bro wser'' ;
import { Con fig Service } from ''./shared/services/con fig .service'' ;
import jsoncon fig from ''../assets/environment/conf.json''
import { MatDialogRef } from ''@angular/material/dialog'' ;
import { HTTP_INTERCEPTORS } from ''@angular/common/http'' ;
import { Msal bro adcastService , MsalGuard , MsalGuardCon fig uration , MsalInterceptor , MsalInterceptorCon fig uration , MsalModule , MsalService , MSAL_GUARD_CON fig , MSAL_INSTANCE , MSAL_INTERCEPTOR_CON fig } from ''@azure/msal-angular'' ;
const isIE = window . navigator . userAgent . indexOf ( "MSIE " ) > - 1 || window . navigator . userAgent . indexOf ( "Trident/" ) > - 1 ;
const AUTH_CON fig _URL_TOKEN = new InjectionToken <string> ( ''AUTH_CON fig _URL'' );
export function initializerFactory ( env : Con fig Service ): any {
// APP_INITIALIZER,except a function return which will return a promise
// APP_INITIALIZER,angular doesnt starts application untill it completes
const promise = env . init (). then (( value ) => {
console . log ( env . getSettings ( ''clientID'' ));
});
return () => promise ;
}
export function MSALInstanceFactory ( conf : Con fig Service ): IPubli ccl ientApplication {
const con fig uration : Con fig uration ={
auth : {
clientId : conf . getSettings ( "clientId" ), // This is the ONLY mandatory field that you need to supply.
authority : ''https://login.microsoftonline.com/'' + conf . getSettings ( "tenentId" ), // Defaults to "https://login.microsoftonline.com/common"
redirectUri : conf . getSettings ( "redirectUri" ), // Points to window.location.origin. You must register this URI on Azure portal/App Registration.
post logo utRedirectUri : ''/'' , // Indicates the page to navigate after logo ut.
navigat eto LoginRequestUrl : true , // If "true",will navigate back to the original request location before processing the auth code response.
}, cache : {
cacheLocation : bro wserCacheLocation . LocalStorage , // Con fig ures cache location. "sessionStorage" is more secure,but "localStorage" gives you SSO between tabs.
storeAuthStateInCookie : isIE , // Set this to "true" if you are having issues on IE11 or Edge
}, sy stem : {
loggerOptions : {
loggerCallback ( logLevel : LogLevel , message : string ) {
console . log ( message );
}, logLevel : LogLevel . Verbose , piiLoggingEnabled : false
}
}
}
return new Publi ccl ientApplication ( con fig uration );
}
export const silentRequest = {
s cop es : [ "openid" , "profile" ], loginHint : "example@domain.net"
};
export const loginRequest = {
s cop es : []
};
export function MSALInterceptorCon fig Factory ( conf : Con fig Service ): MsalInterceptorCon fig uration {
const protectedResources : Map < string , Array <string> >= new Map ([
[ ''https://graph.microsoft.com/v1.0/me'' ,[ ''user.read'' ]],[
''api'' ,[ conf . getSettings ( " apiclient Id" ) + ''/user_impersonation'' ],],]);
return {
in tera ctionType : In tera ctionType . Redirect , protectedResourceMap : protectedResources
};
}
export function MSALGuardCon fig Factory (): MsalGuardCon fig uration {
const auth = {
in tera ctionType : In tera ctionType . Redirect , authRequest : loginRequest
};
return ( auth as MsalGuardCon fig uration )
}
//-------------------------------------------------------------
@NgModule ({
providers : [
], imports : [ MsalModule ]
})
export class MsalConfModule {
static forRoot () {
return {
providers : [
{ provide : AUTH_CON fig _URL_TOKEN },{ provide : APP_INITIALIZER , useFactory : initializerFactory , deps : [ Con fig Service , AUTH_CON fig _URL_TOKEN ], multi : true
},{
provide : HTTP_INTERCEPTORS , useClass : MsalInterceptor , multi : true ,},{
provide : MSAL_INSTANCE , useFactory : MSALInstanceFactory , deps : [ Con fig Service ]
},{
provide : MSAL_GUARD_CON fig , useFactory : MSALGuardCon fig Factory
},{
provide : MSAL_INTERCEPTOR_CON fig , useFactory : MSALInterceptorCon fig Factory , Msal bro adcastService
],}
}
}
我正在尝试在应用模块中使用该包装器
import { NgModule } from ''@angular/core'' ;
import { bro wserModule } from ''@angular/platform- bro wser'' ;
import { AppRoutingModule , AppRoutingComonent } from ''./app-routing.module'' ;
import { AppComponent } from ''./app.component'' ;
import { HttpClientModule , HTTP_INTERCEPTORS } from ''@angular/common/http''
import { MsalConfModule } from ''./authcon fig '' ;
const ngWizardCon fig : NgWizardCon fig = {
theme : THEME . default
};
@NgModule ({
decl ara tions : [
AppComponent , AppRoutingComonent , imports : [
bro wserModule , AppRoutingModule , MsalConfModule
], providers : [
{
provide : MatDialogRef , useValue : {}
}
], bootstrap : [ AppComponent ]
})
export class AppModule {
}
但是在编译时没有错误。我收到运行时错误说
main.ts:12 NullInjectorError:
R3InjectorError(AppModule)[InjectionToken MSAL_GUARD_CONfig ->
InjectionToken MSAL_GUARD_CONfig -> InjectionToken MSAL_GUARD_CONfig]:
NullInjectorError: InjectionToken MSAL_GUARD_CONfig 没有提供程序!
我不明白我做错了什么。请帮忙
根据 Brian 的回答,我尝试在应用模块中添加这样的 forRoot
MsalConfModule . forRoot ()
但这触发了编译错误
Type ''{ providers: (typeof MsalService | typeof MsalGuard | typeof Msal bro adcastService | { provide: InjectionToken<string>; useFactory?: undefined; deps?: undefined; multi?: undefined; useClass?: undefined; } | ... 4 more ... | { ...; })[]; }'' is not assignable to type ''any[] | Type<any> | ModuleWithProviders<{}>'' .
Property ''ngModule'' is missing in type ''{ providers: (typeof MsalService | typeof MsalGuard | typeof Msal bro adcastService | { provide: InjectionToken<string>; useFactory?: undefined; deps?: undefined; multi?: undefined; useClass?: undefined; } | ... 4 more ... | { ...; })[]; }'' but required in type ''ModuleWithProviders<{}>'' . ts ( 2322 )
core . d . ts ( 4279 , 5 ): ''ngModule'' is declared here .
我没提到,我的 Angular 版本 11.0
解决方法
确保将您的 app.module.ts 中的 forRoot()
添加到 MsalConfModule,因为您有一个包含提供程序的模块。
app.module.ts
MsalConfModule . forRoot ()
使用以下内容更新您的 forRoot()
:
export class MsalConfModule {
static forRoot (): ModuleWithProviders < MsalConfModule > {
return {
ngModule : MsalConfModule , providers : [
{ provide : AUTH_CONFIG_URL_TOKEN },{ provide : APP_INITIALIZER , useFactory : initializerFactory , deps : [ ConfigService , AUTH_CONFIG_URL_TOKEN ], multi : true
},{
provide : HTTP_INTERCEPTORS , useClass : MsalInterceptor , multi : true ,},{
provide : MSAL_INSTANCE , useFactory : MSALInstanceFactory , deps : [ ConfigService ]
},{
provide : MSAL_GUARD_CONFIG , useFactory : MSALGuardConfigFactory
},{
provide : MSAL_INTERCEPTOR_CONFIG , useFactory : MSALInterceptorConfigFactory , MsalService , MsalGuard , MsalBroadcastService
],}
}
}
c# – 在Sql Server连接字符串中使用Encrypt = yes – >“provider:SSL Provider,error:0 – 证书的CN名称与传递的值不匹配. 我在sql Server连接字符串中使用Encrypt = yes,因为我需要加密TCPIP流量,但打开连接时会收到错误:
A connection was successfully established with the server,but then an error
occurred during the pre-login handshake. (provider: SSL Provider,error: 0 -
The certificate's CN name does not match the passed value.)
有什么建议如何解决这个问题?我假设我需要一些我的服务器之间的证书关系,但不知道从哪里开始.
我需要这两个连接,每个连接到一个sql 2000服务器,一个到2005服务器.
解决方法
您的数据库连接可以配置为加密流量并接受服务器上的任何证书.不是一个盛大的解决方案,但它对我有用.
生成的连接字符串应如下所示:
"[...];Encrypt=True;TrustServerCertificate=True"
关于部署在Google App Engine上的Strapi无法看到刚通过Strapi Provider for Google Storage上传的图像 的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于ActionController :: RoutingError没有路由与[GET]“ / vendor / assets / stylesheets / bootstrap.min.css”匹配 app / assets / stylesheets / application.css: app / assets / javascript / application.js: app / views / layout / application.html.erb: app / j、angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在、App Module Provider 抛出 NullInjectorError: No provider for InjectionToken MSAL_GUARD_CONFIG、c# – 在Sql Server连接字符串中使用Encrypt = yes – >“provider:SSL Provider,error:0 – 证书的CN名称与传递的值不匹配. 等相关知识的信息别忘了在本站进行查找喔。