Comments (4)
Hey @gpavlov2016 thanks for raising this issue and providing reproduction steps. We will reproduce this internally and provide an update soon.
from amplify-js.
I was able to reproduce the issue but it seems to be expected behavior. The a.allow.resource
method is expected to be used on the schema
level rather than the model level to grant a resource, in this case a lambda function, permission to perform Query, Mutation, and Subscription operations against the GraphQL API.
You can correct your schema code to this and it should work:
const schema = a
.schema({
Video: a
.model({
title: a.string(),
timeOfDayStart: a.time(),
timeOfDayEnd: a.time(),
dateStart: a.date(),
dateEnd: a.date(),
impressionsTarget: a.integer(),
zipCode: a.string(),
s3Key: a.string(),
thumbnail: a.string(),
isRunning: a.boolean(),
})
.authorization([a.allow.owner()]),
})
.authorization([a.allow.resource(functionWithDataAccess)]);
Let me know if this unblocks you or if you run into an issue with this example as well
from amplify-js.
Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you.
Thank you!
from amplify-js.
Applying the authorization to the schema as suggested does remove the type error however it results in a new error during deployment of the sandbox as follows:
const schema = a
.schema({
Video: a
.model({
title: a.string(),
timeOfDayStart: a.time(),
timeOfDayEnd: a.time(),
dateStart: a.date(),
dateEnd: a.date(),
impressionsTarget: a.integer(),
zipCode: a.string(),
s3Key: a.string(),
thumbnail: a.string(),
isRunning: a.boolean(),
})
.authorization([a.allow.owner()]),
})
.authorization([a.allow.resource(getPresignedUrl)]);
Error:
[
[Sandbox] Detected file changes while previous deployment was in progress. Invoking 'sandbox' again
Error: WARNING: owners may reassign ownership for the following model(s) and role(s): Video: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
Bundling asset amplify-nextamplifygen2-GuyPavlov-sandbox-5763ff2c4a/function/presigned-url-lambda/Code/Stage...
X [ERROR] Must use "outdir" when there are multiple input files1 error
node:child_process:929
throw err;
^Error: Command failed: C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@esbuild\win32-x64\esbuild.exe --bundle C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\amplify\functions\presigned-url\handler.ts --target=node18 --platform=node --format=esm --outfile=C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal.amplify\artifacts\cdk.out\bundling-temp-e9230d152b0810080159375cfbc0a4ef95e64e8e4cd66a766f288da9cc5dba82\index.mjs --external:@aws-sdk/* --loader:.node=file --banner:js=/** * This code loads environment values from SSM and places them in their corresponding environment variables. * If there are no SSM environment values for this function, this is a noop. /import { SSM } from '@aws-sdk/client-ssm';/* * Reads SSM environment context from a known Amplify environment variable, * fetches values from SSM and places those values in the corresponding environment variables */export const internalAmplifyFunctionResolveSsmParams = async (client = new SSM()) => { const envPathObject = JSON.parse(process.env.AMPLIFY_SSM_ENV_CONFIG ?? '{}'); const paths = Object.keys(envPathObject); if (paths.length === 0) { return; } const resolveSecrets = async (paths) => { const response = await client.getParameters({ Names: paths, WithDecryption: true, }); if (response.Parameters && response.Parameters.length > 0) { for (const parameter of response.Parameters) { if (parameter.Name) { const envKey = Object.keys(envPathObject).find((key) => envPathObject[key].sharedPath === parameter.Name); const envName = envKey ? envPathObject[envKey].name : envPathObject[parameter.Name]?.name; process.env[envName] = parameter.Value; } } } return response; }; const response = await resolveSecrets(paths); const sharedPaths = (response?.InvalidParameters || []) .map((invalidParam) => envPathObject[invalidParam].sharedPath) .filter((sharedParam) => !!sharedParam); if (sharedPaths.length > 0) { await resolveSecrets(sharedPaths); }};await internalAmplifyFunctionResolveSsmParams();const SSM_PARAMETER_REFRESH_MS = 1000 * 60;setInterval(() => { void internalAmplifyFunctionResolveSsmParams();}, SSM_PARAMETER_REFRESH_MS);export {}; --inject:C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@aws-amplify\backend-function\lib\lambda-shims\cjs_shim.js
at checkExecSyncError (node:child_process:890:11)
at Object.execFileSync (node:child_process:926:15)
at Object. (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\esbuild\bin\esbuild:221:28)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 34788,
stdout: null,
stderr: null
}Node.js v18.19.1
C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:2
),localBundling=options.local?.tryBundle(bundleDir,options),!localBundling){const assetStagingOptions={sourcePath:this.sourcePath,bundleDir,...options};switch(options.bundlingFileAccess){case bundling_1().BundlingFileAccess.VOLUME_COPY:new(asset_staging_1()).AssetBundlingVolumeCopy(assetStagingOptions).run();break;case bundling_1().BundlingFileAccess.BIND_MOUNT:default:new(asset_staging_1()).AssetBundlingBindMount(assetStagingOptions).run();break}}}catch(err){const bundleErrorDir=bundleDir+"-error";throw fs().existsSync(bundleErrorDir)&&fs().removeSync(bundleErrorDir),fs().renameSync(bundleDir,bundleErrorDir),new Error(
Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err})}if(fs_1().FileSystem.isEmpty(bundleDir)){const outputDir=localBundling?bundleDir:AssetStaging.BUNDLING_OUTPUT_DIR;throw new Error(
Bundling did not produce any output. Check that content is written to ${outputDir}.)}}calculateHash(hashType,bundling,outputDir){if(hashType==assets_1().AssetHashType.CUSTOM||hashType==assets_1().AssetHashType.SOURCE&&bundling){const hash=crypto().createHash("sha256");return hash.update(this.customSourceFingerprint??fs_1().FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions)),bundling&&hash.update(JSON.stringify(bundling,sanitizeHashValue)),hash.digest("hex")}switch(hashType){case assets_1().AssetHashType.SOURCE:return fs_1().FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions);case assets_1().AssetHashType.BUNDLE:case assets_1().AssetHashType.OUTPUT:if(!outputDir)throw new Error(
Cannot use `${hashType}` hash type when `bundling` is not specified.);return fs_1().FileSystem.fingerprint(outputDir,this.fingerprintOptions);default:throw new Error("Unknown asset hash type.")}}}exports.AssetStaging=AssetStaging,_a=JSII_RTTI_SYMBOL_1,AssetStaging[_a]={fqn:"aws-cdk-lib.AssetStaging",version:"2.134.0"},AssetStaging.BUNDLING_INPUT_DIR="/asset-input",AssetStaging.BUNDLING_OUTPUT_DIR="/asset-output",AssetStaging.assetCache=new(cache_1()).Cache;function renderAssetFilename(assetHash,extension=""){return
asset.${assetHash}${extension}}function determineHashType(assetHashType,customSourceFingerprint){const hashType=customSourceFingerprint?assetHashType??assets_1().AssetHashType.CUSTOM:assetHashType??assets_1().AssetHashType.SOURCE;if(customSourceFingerprint&&hashType!==assets_1().AssetHashType.CUSTOM)throw new Error(
Cannot specify `${assetHashType}` for `assetHashType` when `assetHash` is specified. Use `CUSTOM` or leave `undefined`.);if(hashType===assets_1().AssetHashType.CUSTOM&&!customSourceFingerprint)throw new Error("
assetHashmust be specified when
assetHashTypeis set to
AssetHashType.CUSTOM.");return hashType}function calculateCacheKey(props){return crypto().createHash("sha256").update(JSON.stringify(sortObject(props),sanitizeHashValue)).digest("hex")}function sortObject(object){if(typeof object!="object"||object instanceof Array)return object;const ret={};for(const key of Object.keys(object).sort())ret[key]=sortObject(object[key]);return ret}function sanitizeHashValue(key,value){if(key==="PIP_INDEX_URL"||key==="PIP_EXTRA_INDEX_URL")try{let url=new URL(value);if(url.password)return url.password="",url.toString()}catch(e){throw e.name==="TypeError"?new Error(
${key} must be a valid URL, got ${value}.):e}return value}function findSingleFile(directory,archiveOnly){if(!fs().existsSync(directory))throw new Error(
Directory ${directory} does not exist.);if(!fs().statSync(directory).isDirectory())throw new Error(
${directory} is not a directory.);const content=fs().readdirSync(directory);if(content.length===1){const file=path().join(directory,content[0]),extension=getExtension(content[0]).toLowerCase();if(fs().statSync(file).isFile()&&(!archiveOnly||ARCHIVE_EXTENSIONS.includes(extension)))return file}}function determineBundledAsset(bundleDir,outputType){const archiveFile=findSingleFile(bundleDir,outputType!==bundling_1().BundlingOutput.SINGLE_FILE);switch(outputType===bundling_1().BundlingOutput.AUTO_DISCOVER&&(outputType=archiveFile?bundling_1().BundlingOutput.ARCHIVED:bundling_1().BundlingOutput.NOT_ARCHIVED),outputType){case bundling_1().BundlingOutput.NOT_ARCHIVED:return{path:bundleDir,packaging:assets_1().FileAssetPackaging.ZIP_DIRECTORY};case bundling_1().BundlingOutput.ARCHIVED:case bundling_1().BundlingOutput.SINGLE_FILE:if(!archiveFile)throw new Error("Bundling output directory is expected to include only a single file when
outputis set to
ARCHIVEDor
SINGLE_FILE`");return{path:archiveFile,packaging:assets_1().FileAssetPackaging.FILE,extension:getExtension(archiveFile)}}}function getExtension(source){for(const ext of ARCHIVE_EXTENSIONS)if(source.toLowerCase().endsWith(ext))return ext;return path().extname(source)}^
Error: Failed to bundle asset amplify-nextamplifygen2-GuyPavlov-sandbox-5763ff2c4a/function/presigned-url-lambda/Code/Stage, bundle output is located at C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal.amplify\artifacts\cdk.out\bundling-temp-e9230d152b0810080159375cfbc0a4ef95e64e8e4cd66a766f288da9cc5dba82-error: Error: cmd /c npx.cmd --no-install esbuild --bundle "C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\amplify\functions\presigned-url\handler.ts" --target=node18 --platform=node --format=esm --outfile="C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal.amplify\artifacts\cdk.out\bundling-temp-e9230d152b0810080159375cfbc0a4ef95e64e8e4cd66a766f288da9cc5dba82\index.mjs" --external:@aws-sdk/* --loader:.node=file --banner:js="/** * This code loads environment values from SSM and places them in their corresponding environment variables. * If there are no SSM environment values for this function, this is a noop. /import { SSM } from '@aws-sdk/client-ssm';/* * Reads SSM environment context from a known Amplify environment variable, * fetches values from SSM and places those values in the corresponding environment variables */export const internalAmplifyFunctionResolveSsmParams = async (client = new SSM()) => { const envPathObject = JSON.parse(process.env.AMPLIFY_SSM_ENV_CONFIG ?? '{}'); const paths = Object.keys(envPathObject); if (paths.length === 0) { return; } const resolveSecrets = async (paths) => { const response = await client.getParameters({ Names: paths, WithDecryption: true, }); if (response.Parameters && response.Parameters.length > 0) { for (const parameter of response.Parameters) { if (parameter.Name) {
const envKey = Object.keys(envPathObject).find((key) => envPathObject[key].sharedPath === parameter.Name); const envName = envKey ? envPathObject[envKey].name : envPathObject[parameter.Name]?.name; process.env[envName] = parameter.Value; } } } return response; }; const response = await resolveSecrets(paths); const sharedPaths = (response?.InvalidParameters || []) .map((invalidParam) => envPathObject[invalidParam].sharedPath) .filter((sharedParam) => !!sharedParam); if (sharedPaths.length > 0) { await resolveSecrets(sharedPaths); }};await internalAmplifyFunctionResolveSsmParams();const SSM_PARAMETER_REFRESH_MS = 1000 * 60;setInterval(() => { void internalAmplifyFunctionResolveSsmParams();}, SSM_PARAMETER_REFRESH_MS);export {};" --inject:C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@aws-amplify\backend-function\lib\lambda-shims\cjs_shim.js run in directory C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal exited with status 1
at AssetStaging.bundle (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:2:619)
at AssetStaging.stageByBundling (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:1:5297)
at stageThisAsset (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:1:2728)
at Cache.obtain (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\private\cache.js:1:242)
at new AssetStaging (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:1:3125)
at new Asset (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-s3-assets\lib\asset.js:1:1080)
at AssetCode.bind (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-lambda\lib\code.js:1:4881)
at new Function (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-lambda\lib\function.js:1:9422)
at new NodejsFunction (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-lambda-nodejs\lib\function.js:1:1669)
at AmplifyFunction (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@aws-amplify\backend-function\src\factory.ts:292:28)Node.js v18.19.1
Subprocess exited with error 1Caused By: WARNING: owners may reassign ownership for the following model(s) and role(s): Video: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
Bundling asset amplify-nextamplifygen2-GuyPavlov-sandbox-5763ff2c4a/function/presigned-url-lambda/Code/Stage...
X [ERROR] Must use "outdir" when there are multiple input files1 error
node:child_process:929
throw err;
^Error: Command failed: C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@esbuild\win32-x64\esbuild.exe --bundle C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\amplify\functions\presigned-url\handler.ts --target=node18 --platform=node --format=esm --outfile=C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal.amplify\artifacts\cdk.out\bundling-temp-e9230d152b0810080159375cfbc0a4ef95e64e8e4cd66a766f288da9cc5dba82\index.mjs --external:@aws-sdk/* --loader:.node=file --banner:js=/** * This code loads environment values from SSM and places them in their corresponding environment variables. * If there are no SSM environment values for this function, this is a noop. /import { SSM } from '@aws-sdk/client-ssm';/* * Reads SSM environment context from a known Amplify environment variable, * fetches values from SSM and places those values in the corresponding environment variables */export const internalAmplifyFunctionResolveSsmParams = async (client = new SSM()) => { const envPathObject = JSON.parse(process.env.AMPLIFY_SSM_ENV_CONFIG ?? '{}'); const paths = Object.keys(envPathObject); if (paths.length === 0) { return; } const resolveSecrets = async (paths) => { const response = await client.getParameters({ Names: paths, WithDecryption: true, }); if (response.Parameters && response.Parameters.length > 0) { for (const parameter of response.Parameters) { if (parameter.Name) { const envKey = Object.keys(envPathObject).find((key) => envPathObject[key].sharedPath === parameter.Name); const envName = envKey ? envPathObject[envKey].name : envPathObject[parameter.Name]?.name; process.env[envName] = parameter.Value; } } } return response; }; const response = await resolveSecrets(paths); const sharedPaths = (response?.InvalidParameters || []) .map((invalidParam) => envPathObject[invalidParam].sharedPath) .filter((sharedParam) => !!sharedParam); if (sharedPaths.length > 0) { await resolveSecrets(sharedPaths); }};await internalAmplifyFunctionResolveSsmParams();const SSM_PARAMETER_REFRESH_MS = 1000 * 60;setInterval(() => { void internalAmplifyFunctionResolveSsmParams();}, SSM_PARAMETER_REFRESH_MS);export {}; --inject:C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@aws-amplify\backend-function\lib\lambda-shims\cjs_shim.js
at checkExecSyncError (node:child_process:890:11)
at Object.execFileSync (node:child_process:926:15)
at Object. (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\esbuild\bin\esbuild:221:28)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 34788,
stdout: null,
stderr: null
}Node.js v18.19.1
C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:2
),localBundling=options.local?.tryBundle(bundleDir,options),!localBundling){const assetStagingOptions={sourcePath:this.sourcePath,bundleDir,...options};switch(options.bundlingFileAccess){case bundling_1().BundlingFileAccess.VOLUME_COPY:new(asset_staging_1()).AssetBundlingVolumeCopy(assetStagingOptions).run();break;case bundling_1().BundlingFileAccess.BIND_MOUNT:default:new(asset_staging_1()).AssetBundlingBindMount(assetStagingOptions).run();break}}}catch(err){const bundleErrorDir=bundleDir+"-error";throw fs().existsSync(bundleErrorDir)&&fs().removeSync(bundleErrorDir),fs().renameSync(bundleDir,bundleErrorDir),new Error(
Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err})}if(fs_1().FileSystem.isEmpty(bundleDir)){const outputDir=localBundling?bundleDir:AssetStaging.BUNDLING_OUTPUT_DIR;throw new Error(
Bundling did not produce any output. Check that content is written to ${outputDir}.)}}calculateHash(hashType,bundling,outputDir){if(hashType==assets_1().AssetHashType.CUSTOM||hashType==assets_1().AssetHashType.SOURCE&&bundling){const hash=crypto().createHash("sha256");return hash.update(this.customSourceFingerprint??fs_1().FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions)),bundling&&hash.update(JSON.stringify(bundling,sanitizeHashValue)),hash.digest("hex")}switch(hashType){case assets_1().AssetHashType.SOURCE:return fs_1().FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions);case assets_1().AssetHashType.BUNDLE:case assets_1().AssetHashType.OUTPUT:if(!outputDir)throw new Error(
Cannot use `${hashType}` hash type when `bundling` is not specified.);return fs_1().FileSystem.fingerprint(outputDir,this.fingerprintOptions);default:throw new Error("Unknown asset hash type.")}}}exports.AssetStaging=AssetStaging,_a=JSII_RTTI_SYMBOL_1,AssetStaging[_a]={fqn:"aws-cdk-lib.AssetStaging",version:"2.134.0"},AssetStaging.BUNDLING_INPUT_DIR="/asset-input",AssetStaging.BUNDLING_OUTPUT_DIR="/asset-output",AssetStaging.assetCache=new(cache_1()).Cache;function renderAssetFilename(assetHash,extension=""){return
asset.${assetHash}${extension}}function determineHashType(assetHashType,customSourceFingerprint){const hashType=customSourceFingerprint?assetHashType??assets_1().AssetHashType.CUSTOM:assetHashType??assets_1().AssetHashType.SOURCE;if(customSourceFingerprint&&hashType!==assets_1().AssetHashType.CUSTOM)throw new Error(
Cannot specify `${assetHashType}` for `assetHashType` when `assetHash` is specified. Use `CUSTOM` or leave `undefined`.);if(hashType===assets_1().AssetHashType.CUSTOM&&!customSourceFingerprint)throw new Error("
assetHashmust be specified when
assetHashTypeis set to
AssetHashType.CUSTOM.");return hashType}function calculateCacheKey(props){return crypto().createHash("sha256").update(JSON.stringify(sortObject(props),sanitizeHashValue)).digest("hex")}function sortObject(object){if(typeof object!="object"||object instanceof Array)return object;const ret={};for(const key of Object.keys(object).sort())ret[key]=sortObject(object[key]);return ret}function sanitizeHashValue(key,value){if(key==="PIP_INDEX_URL"||key==="PIP_EXTRA_INDEX_URL")try{let url=new URL(value);if(url.password)return url.password="",url.toString()}catch(e){throw e.name==="TypeError"?new Error(
${key} must be a valid URL, got ${value}.):e}return value}function findSingleFile(directory,archiveOnly){if(!fs().existsSync(directory))throw new Error(
Directory ${directory} does not exist.);if(!fs().statSync(directory).isDirectory())throw new Error(
${directory} is not a directory.);const content=fs().readdirSync(directory);if(content.length===1){const file=path().join(directory,content[0]),extension=getExtension(content[0]).toLowerCase();if(fs().statSync(file).isFile()&&(!archiveOnly||ARCHIVE_EXTENSIONS.includes(extension)))return file}}function determineBundledAsset(bundleDir,outputType){const archiveFile=findSingleFile(bundleDir,outputType!==bundling_1().BundlingOutput.SINGLE_FILE);switch(outputType===bundling_1().BundlingOutput.AUTO_DISCOVER&&(outputType=archiveFile?bundling_1().BundlingOutput.ARCHIVED:bundling_1().BundlingOutput.NOT_ARCHIVED),outputType){case bundling_1().BundlingOutput.NOT_ARCHIVED:return{path:bundleDir,packaging:assets_1().FileAssetPackaging.ZIP_DIRECTORY};case bundling_1().BundlingOutput.ARCHIVED:case bundling_1().BundlingOutput.SINGLE_FILE:if(!archiveFile)throw new Error("Bundling output directory is expected to include only a single file when
outputis set to
ARCHIVEDor
SINGLE_FILE`");return{path:archiveFile,packaging:assets_1().FileAssetPackaging.FILE,extension:getExtension(archiveFile)}}}function getExtension(source){for(const ext of ARCHIVE_EXTENSIONS)if(source.toLowerCase().endsWith(ext))return ext;return path().extname(source)}^
Error: Failed to bundle asset amplify-nextamplifygen2-GuyPavlov-sandbox-5763ff2c4a/function/presigned-url-lambda/Code/Stage, bundle output is located at C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal.amplify\artifacts\cdk.out\bundling-temp-e9230d152b0810080159375cfbc0a4ef95e64e8e4cd66a766f288da9cc5dba82-error: Error: cmd /c npx.cmd --no-install esbuild --bundle "C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\amplify\functions\presigned-url\handler.ts" --target=node18 --platform=node --format=esm --outfile="C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal.amplify\artifacts\cdk.out\bundling-temp-e9230d152b0810080159375cfbc0a4ef95e64e8e4cd66a766f288da9cc5dba82\index.mjs" --external:@aws-sdk/* --loader:.node=file --banner:js="/** * This code loads environment values from SSM and places them in their corresponding environment variables. * If there are no SSM environment values for this function, this is a noop. /import { SSM } from '@aws-sdk/client-ssm';/* * Reads SSM environment context from a known Amplify environment variable, * fetches values from SSM and places those values in the corresponding environment variables */export const internalAmplifyFunctionResolveSsmParams = async (client = new SSM()) => { const envPathObject = JSON.parse(process.env.AMPLIFY_SSM_ENV_CONFIG ?? '{}'); const paths = Object.keys(envPathObject); if (paths.length === 0) { return; } const resolveSecrets = async (paths) => { const response = await client.getParameters({ Names: paths, WithDecryption: true, }); if (response.Parameters && response.Parameters.length > 0) { for (const parameter of response.Parameters) { if (parameter.Name) {
const envKey = Object.keys(envPathObject).find((key) => envPathObject[key].sharedPath === parameter.Name); const envName = envKey ? envPathObject[envKey].name : envPathObject[parameter.Name]?.name; process.env[envName] = parameter.Value; } } } return response; }; const response = await resolveSecrets(paths); const sharedPaths = (response?.InvalidParameters || []) .map((invalidParam) => envPathObject[invalidParam].sharedPath) .filter((sharedParam) => !!sharedParam); if (sharedPaths.length > 0) { await resolveSecrets(sharedPaths); }};await internalAmplifyFunctionResolveSsmParams();const SSM_PARAMETER_REFRESH_MS = 1000 * 60;setInterval(() => { void internalAmplifyFunctionResolveSsmParams();}, SSM_PARAMETER_REFRESH_MS);export {};" --inject:C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@aws-amplify\backend-function\lib\lambda-shims\cjs_shim.js run in directory C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal exited with status 1
at AssetStaging.bundle (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:2:619)
at AssetStaging.stageByBundling (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:1:5297)
at stageThisAsset (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:1:2728)
at Cache.obtain (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\private\cache.js:1:242)
at new AssetStaging (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\core\lib\asset-staging.js:1:3125)
at new Asset (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-s3-assets\lib\asset.js:1:1080)
at AssetCode.bind (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-lambda\lib\code.js:1:4881)
at new Function (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-lambda\lib\function.js:1:9422)
at new NodejsFunction (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules\aws-cdk-lib\aws-lambda-nodejs\lib\function.js:1:1669)
at AmplifyFunction (C:\Users\Guy Pavlov\UpWork\ad-platform\ad-portal\node_modules@aws-amplify\backend-function\src\factory.ts:292:28)Node.js v18.19.1
Subprocess exited with error 1[Sandbox] Watching for file changes...
from amplify-js.
Related Issues (20)
- amplify/auth resetPassword succeeds but customSmsSender trigger lambda never called HOT 3
- Federated Sign-in - App Sync list query Auth Error HOT 2
- Amplify not works well if I have configuring multiple user pools with condition
- Next, js, Amplify js.fetchAuthSession({forceRefresh: true}) does not work as expected and returns tokens as undefined. How to manage a refresh token in Amplify v6 in Next.js HOT 4
- Amplify CLI Gen 2 - Multiple SortKeys combined into one input with GraphQL Generation HOT 5
- AWS storage upload issue HOT 2
- Datastore.save() sending _version of previous query model instead of current model. HOT 2
- runWithAmplifyServerContext throwing error, ⨯ Error: Cannot access Cognito.length on the server. You cannot dot into a client module from a server component. You can only pass the imported name through. HOT 4
- 6.3.3 is stable ? HOT 1
- ResizeObserver loop when navigating in the Authenticator component HOT 1
- [v6] resetPassword not trigger UserMigration lambda HOT 2
- Add timeout on GET and POST api calls for amplify v6 HOT 2
- No federated JWT token when using AppSync OIDC in Amplify Gen2 HOT 5
- Permission denied - allow.authenticated() HOT 6
- [v6] sendUserAttributeVerificationCode not send code to destination email HOT 5
- MD5 not calculating correctly when selecting file from broswer, failing with BadDigest Error HOT 4
- Auth.SignIn not allowing username only signin HOT 2
- `Hub.listen` not firing when inside `useEffect` HOT 14
- Hub should automatically fire `tokenRefresh` event through Hub HOT 1
- Google login in react native requires two login attempts to work only on production ANDROID HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-js.