question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.20.0-alpha4 Version has S3 bucket region bug when bucket region is specfied in config file.

See original GitHub issue

Describe the bug

When I specify bucket region. InvaliadParameterValueException error is occured. like below.

next-serverless:
  component: "@sls-next/serverless-component@1.20.0-alpha.4"
  inputs:
    roleArn: "{custom role}"
    bucketRegion: 'ap-northeast-1'

Actual behavior

Actual behavior is written in Screenshots/Code/Logs section.

Expected behavior

ap-northeast-1 region’s S3 bucket is created and ISR works.

Steps to reproduce

Screenshots/Code/Logs

  error:
  InvalidParameterValueException: Function does not exist
    at Object.extractError (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/protocol/json.js:52:27)
    at Request.extractError (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/protocol/rest_json.js:55:8)
    at Request.callListeners (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/{username}/.serverless/components/registry/npm/@sls-next/serverless-component@1.20.0-alpha.4/node_modules/aws-sdk/lib/request.js:690:12) {
  code: 'InvalidParameterValueException',
  time: 2021-05-23T13:24:46.183Z,
  requestId: '18399683-0ad5-467a-9ffb-1fa6b666ddfb',
  statusCode: 400,
  retryable: false,
  retryDelay: 83.94330763177335
}

  140s › next-serverless › InvalidParameterValueException: Function does not exist

Versions

next-serverless:
  component: "@sls-next/serverless-component@1.20.0-alpha.4"
  inputs:
    roleArn: "{custom role}"
    bucketRegion: 'ap-northeast-1'
{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "@aws-amplify/ui-react": "^1.1.0",
    "aws-amplify": "^3.4.0",
    "aws-appsync": "^4.0.3",
    "aws-sdk": "^2.907.0",
    "better-sqlite3": "^7.4.0",
    "graphql-tag": "^2.12.4",
    "hdb-pool": "^0.1.6",
    "ioredis": "^4.27.2",
    "mongodb": "^3.6.6",
    "mongodb-client-encryption": "^1.2.3",
    "mysql": "^2.18.1",
    "mysql2": "^2.2.5",
    "next": "10.2.0",
    "next-auth": "^3.23.0",
    "next-auth-dynamodb": "^0.3.3",
    "oracledb": "^5.1.0",
    "pg": "^8.6.0",
    "pg-native": "^3.0.0",
    "pg-query-stream": "^4.1.0",
    "pino-pretty": "^4.8.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "sqlite3": "^5.0.2",
    "typeorm-aurora-data-api-driver": "^2.1.0"
  },
  "devDependencies": {
    "@types/node": "^15.0.2",
    "@types/react": "^17.0.5",
    "typescript": "^4.2.4"
  }
}

Additional context

Bucket region is not specfied in serverless.yml. us-east-1 S3 bucket is created, and ISR works.

like below.

# serverless.yml
next-serverless:
  component: "@sls-next/serverless-component@1.20.0-alpha.4"
  inputs:
    roleArn: "{custom-role}"

Checklist

  • You have reviewed the README and FAQs, which answers several common questions.
  • Please first try using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ckjoriscommented, Jun 2, 2021

added some logging before await sqs.addEventSource(regenerationLambdaResult.name); in serverless-next.js/packages/serverless-components/nextjs-component/src/component.ts but it doesn’t seem to go there, no logs printed.

But deployment succeeded after changing https://github.com/serverless-nextjs/serverless-next.js/blob/e7031355d4bf6dcac5bef6009456fbaae1f3b98c/packages/serverless-components/aws-sqs/serverless.js#L19 region to ‘eu-central-1’.

0reactions
dphangcommented, Jun 7, 2021

Thanks, makes sense since Lambda for regeneration is using bucket region specified but SQS queue does not use same region, and it is using us-east-1 by default. So it cannot find the function since it’s in the wrong region. Will fix it by using bucketRegion for SQS’s region.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot "Invalid S3 location" error when saving query ...
Verify that you specified the query result location in S3 by doing the following: Open the Athena console. Choose Settings from the navigation ......
Read more >
Issues connecting apache drill with aws s3 region which only ...
I had the same error occurred while trying to connect Apache Drill version 1.16.0 to Signature Version 4 only S3 bucket in MEA...
Read more >
1.20 Ensure that S3 Buckets are configured with 'Block public
Information. Amazon S3 provides Block public access (bucket settings) and Block public access (account settings) to help you manage public access to Amazon ......
Read more >
terraform-aws-modules/s3-bucket/aws
versioning; CORS; lifecycle rules; server-side encryption; object locking; Cross-Region Replication (CRR); ELB log delivery bucket policy; ALB/ ...
Read more >
Amazon S3 Storage Providers - Rclone
Old versions of files, where available, are visible using the --s3-versions flag. It is also possible to view a bucket as it was...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found