Deployment to AWS results in Permanent Redirect error
See original GitHub issueDescribe the bug
Serverless deploy results in:
PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
at Request.extractError (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/services/s3.js:837:35)
at Request.callListeners (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/request.js:688:14)
at Request.transition (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/request.js:690:12)
at Request.callListeners (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at Request.emit (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/request.js:688:14)
at Request.transition (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.17.0/node_modules/@sls-next/s3-static-assets/node_modules/aws-sdk/lib/request.js:38:9) {
code: 'PermanentRedirect',
region: 'us-east-1',
time: 2021-06-18T11:12:06.199Z,
requestId: '93A8YNZG8N7Q1Q63',
extendedRequestId: 'YNxh1Se5YqoTlqc+0VHbNw7IaL/VUypr5aO6NCr8w4eqMOo/40ZLdwQZ9S3NN1KbU+Qs8LGiL58=',
cfId: 'rdIFedJdAXXPw1Ic7Edy8GGmqqqkPJlJ8ieiEN3b2CPR0Tr1bjnetQ==',
statusCode: 301,
retryable: false,
retryDelay: 78.28970486390303
We’ve not changed anything that we can readily identify and it happens only in some deploys mostly on one AWS environment. Mostly the failure have been on a test environment, but we’ve also seen the failure happen on our dev environment.
It worked briefly when we upgraded from 1.17 -> 1.18 and carried on failing after. Most deployments are failing now, but not all.
Actual behavior
See above
Expected behavior
It should deploy to AWS
Steps to reproduce
We have no idea. We have smaller nextjs projects that are deploying fine and continue to do so into the environments affected.
Also, we spent the morning debugging it and it magically fixed itself this morning. Submitting issue on the basis we’d dearly love to know what happened, but accept that might be asking too much from the universe…
Screenshots/Code/Logs
admin:
component: '@sls-next/serverless-component@1.17'
inputs:
description: 'DT+ Trials App on Lambda@Edge'
name:
defaultLambda: trials-app-default
apiLambda: trials-app-api
policy: 'arn:aws:iam::690642816946:policy/admin-app-systems-manager-read'
bucketName: ${env.TRIALS_DEPLOYMENT_BUCKET}
memorySize: 1024
AccelerateConfiguration:
AccelerationStatus: Enabled
Versions
- OS/Environment:
- @sls-next/serverless-component version:
- Next.js version:
Additional context
Checklist
- You have reviewed the README and FAQs, which answers several common questions.
- Please first try using the most recent
latest
oralpha
@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 oldserverless-next.js
component and theserverless-next.js
plugin are deprecated and no longer maintained.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top GitHub Comments
No workaround yet - I am trying to see why it’s still failing even when setting regional s3 endpoint above. Updated in PR: https://github.com/serverless-nextjs/serverless-next.js/pull/1263
Hopefully fixed by this: https://github.com/serverless-nextjs/serverless-next.js/pull/1263, ran e2e tests a few times and it seems stable?
Though we shouldn’t need to manually set endpoint but maybe there’s a bug in AWS sdk?