小编Kei*_*ris的帖子

在 AWS Lambda 函数中运行 Sharp 时出错:无法在“linux-x64”平台上使用 darwin-x64' 二进制文件

当尝试在 AWS Lambda 函数内运行时,我不断收到以下错误:

darwin-x64' 二进制文件不能在 'linux-x64' 平台上使用。请删除“node_modules/sharp/vendor”目录并运行“npm install”

我使用 MacBook Pro 中的无服务器框架部署了无服务器应用程序。我该如何解决这个问题?

aws-lambda sharp macos-mojave

12
推荐指数
2
解决办法
6381
查看次数

使用预签名 URL 上传到 S3 存储桶会出现 403 禁止错误

我正在尝试使用 AWS S3 预签名 URL 为 Vue 应用程序实现图片上传功能。第一步是向 API 发送请求,该 API 将创建签名 URL 来上传文件。这部分工作正常:

服务器端:

'use strict';

const aws = require('aws-sdk');
const config = require('../config');
const util = require('./util');
const uuidv4 = require('uuid/v4');

const bucketName = 'myAmazonS3Bucket';

aws.config.update({
  secretAccessKey: config.AWS_SECRET_ACCESS_KEY,
  accessKeyId: config.AWS_ACCESS_KEY_ID,
  region: 'us-west-2'
});

const s3 = new aws.S3({ signatureVersion: 'v4' });

const handler = async (event) => {
    console.log('Uploading file...');

    return await getUploadURL();
}

const getUploadURL = async () => {
    const actionId = uuidv4();

    const s3Params = …
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services pre-signed-url

5
推荐指数
1
解决办法
1万
查看次数

使用'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'找到的构造函数都没有

我收到以下错误消息:

System.InvalidOperationException:尝试创建"App.Web.Controllers.ContractWizardController"类型的控制器时发生错误.确保控制器具有无参数的公共构造函数.---> Autofac.Core.DependencyResolutionException:可以使用可用的服务和参数调用在'App.Web.Controllers.ContractWizardController'类型上找到'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'的构造函数:无法解析构造函数'Void .ctor(App.Service.IWizardTypeStepService,App.Service.IAppBrandService,App.Service.IAppInstitutionService)'的参数'App.Service.IWizardTypeStepService wizardTypeStepService'.
at autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context,IEnumerable 1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1参数)at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope,IComponentRegistration registration,IEnumerable)1 parameters) at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(IComponentRegistration registration, IEnumerable1个参数)Autofac.Resolution.ResolveOperation.Execute(IComponentRegistration注册,IEnumerable 1 parameters) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1参数)在Autofac.ResolutionExtensions.TryResolveService(IComponentContext上下文,服务服务,IEnumerable 1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable1参数)在Autofac.ResolutionExtensions.ResolveOptional(IComponentContext上下文,类型serviceType) System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext,Type)中的Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(类型serviceType)上的Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context,Type serviceType),IEnumerable`1参数) controlle rType)---在System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext,Type controllerType)的System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext,Type controllerType)的内部异常堆栈跟踪结束在System.Web.Mvc.DefaultControllerFactory.CreateController(的RequestContext的RequestContext,字符串controllerName)在System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase HttpContext的,一个IController&控制器,IControllerFactory&工厂)
在System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase HttpContext的System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context,AsyncCallback cb,System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext,AsyncCallback callback,Object state)中的AsyncCallback回调,Object状态) System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep中的Object extraData)System.Web.HttpApplication.ExecuteStep中的.Execute()(IExecutionStep step,Boolean&completedSynchronously)

Global.asax中

public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles); …
Run Code Online (Sandbox Code Playgroud)

c# autofac

3
推荐指数
1
解决办法
9876
查看次数

JQuery Select2在bootbox对话框模式中无法正确显示

当我在页面上使用JQuery Select2时它工作正常.但是,当它位于引导框对话框模式中时,它无法正确显示.

在此输入图像描述

这是我正在使用的jquery代码...

$.ajax({
        type: 'GET',
        url: src,
        success: function (data) {
            if (allowed) {
                bootbox.dialog({
                    title: dialogTitle,
                    message: $('#altForm'),
                    onEscape: true,
                    show: false // We will show it manually later
                }).on('shown.bs.modal', function () {
                    $('#enterBtn').hide();
                    $('#userPwd').hide();
                    $('.app-ctrl').prop('disabled', true);
                    $('#altForm').show();
                }).on('hide.bs.modal', function (e) {
                    $('#altForm').hide().appendTo('body');
                }).modal('show');
                $('.boop').parents('.bootbox').removeAttr('tabindex');
                $('.boop').select2();
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

我相信Select2下拉列表的代码是有效的,因为当我注释掉初始化行时:$('.boop').select2(); 选择下拉列表变为常规下拉列表.但我不知道为什么它显示不正确.

bootbox select2

2
推荐指数
1
解决办法
1038
查看次数